When I browse to the .svc I continually get the error: Metadata publishing for this service is currently disabled.
I have followed all of the instructions listed on the error page (added the behavior, referenced the behavior, added the mex endpoint, tried both with and without baseaddress), along with the instructions on MSDN: http://msdn.microsoft.com/en-us/library/ms734765.aspx (pretty much the same, but include the policyversion). I even gutted my config file and only left this stuff – it just doesn’t make any difference at all. I’ve confirmed that the config file is being used (i.e. make a mistake in it, and the error changes).
Section looks like:
<system.serviceModel>
<services>
<service name="HoldingService" behaviorConfiguration="SimpleServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost/xxxx.cdf.holding/HoldingService.svc"/>
</baseAddresses>
</host>
<endpoint address=""
binding="basicHttpBinding"
contract="Xxx.Xxxx.Schema.Service.Cdf.Holding.IHoldingService" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="SimpleServiceBehavior">
<serviceMetadata httpGetEnabled="True" policyVersion="Policy15" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Is there any way at all to fix or debug this?
I managed to resolve this. The problem was
name="HoldingService". Even though the .svc is in the same project as the .config, it needed to be fully qualified (i.e.name="Xxx.Xxxx.Web.Cdf.Holding.HoldingService").The final code looks like this and works perfectly:
As an aside, the way I ended up resolving this was by using the “Microsoft Service Configuration Editor” (accessible via
Tools>WCF Service Configuration Editorin VS2010). I didn’t know this existed and had been hand-cutting the config.Thanks Michael for your suggestions – they cleaned the code up a lot.