Monday, June 29, 2009

Secure Metadata in WCF

I've set up a service to be hosted in IIS using wsHttpBinding and want the mex endpoint to be secure as well. I got the following error:

Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service.

There is no way I can have anonymous access enabled in IIS so what do you do?

Short answer: don't use mexHttpsBinding (or mexHttpBinding for that matter).

I've already got a wsHttpBinding and associated binding configuration, so I've just modified the existing mex endpoint.

From:

<endpoint address="mex" binding="mexHttpsBinding" name="mexHttps"
contract="IMetadataExchange" />

To:

<endpoint address="mex" binding="wsHttpBinding" bindingConfiguration="wsSecureBinding" name="mexHttps" contract="IMetadataExchange" />


This assumes you already have a bindingConfiguration called wsSecureBinding.

Friday, June 12, 2009

Convert VS2005 to VS2005 changes xml namespace of typed dataset

A warning for anyone who is converting a solution from Visual Studio 2005 to Visual Studio 2008 - the conversion wizard may change the xml namespace of your strongly typed datasets. 

I've just had a scenario where an upgraded project failed to perform the typedDS.ReadXml() method. The xml fragment to be loaded had the namespace specified and hence since the ds namespace was changed no longer loaded the xml. This resulted in an empty dataset. After some digging I found that the namespace in the typedDS.Designer.cs file had been changed as part of the conversion.

Cheers.