none
'Metadata publishing for this service is currently disabled' message with WCF service

    Question

  • Whenever I try to add a web reference to the WCF service in my project, I get an error:

    'The HTML document does not contain Web service discovery information.
    There was an error downloading 'http://localhost/OFTestSite/Service.svc/$metadata'.
    The request failed with HTTP status 400: Bad Request.'

    When I browse Service.svc directly from the IIS, the page opens with the statement 'Metadata publishing for this service is currently disabled.'

    I followed all the steps correctly to make metadata publishing enabled, but still I get the same message and I'm not able to add the web refernce.

    Could anyone please help me? 

    (I am using VS 2010 Professional on Windows XP machine with IIS 5.1)

    Monday, October 18, 2010 10:46 AM

Answers

  • Hi....

    In your web.config file,In Behavior section set <serviceMetadata httpGetEnabled="true"> and then try to add referance.

    For Ex.

    <behaviors>
       <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <serviceAuthorization principalPermissionMode="Custom">
           <authorizationPolicies>
            <add policyType="" />
           </authorizationPolicies>
          </serviceAuthorization>
        </behavior>
       </serviceBehaviors>
      </behaviors>

    Regards, Hiren Bharadwa
    Thursday, October 21, 2010 5:36 AM

All replies

  • Hi,

    Have you added the MEX endpoint as well as set the service property Httpgetenable to true?


    Regards, Nakul
    Monday, October 18, 2010 11:45 AM
  • Yes. I have two end points. One is MEX which you have mentioned and another is custom binding which too has httGetEnabled set to true.

     

    Monday, October 18, 2010 11:58 AM
  • Hi,

    Could you post the settings in your config file?


    Please remember to mark the replies as answers if they help and unmark them if they provide no help. Windows Azure Platform China Blog: http://blogs.msdn.com/azchina/default.aspx
    Thursday, October 21, 2010 5:30 AM
  • Hi....

    In your web.config file,In Behavior section set <serviceMetadata httpGetEnabled="true"> and then try to add referance.

    For Ex.

    <behaviors>
       <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <serviceAuthorization principalPermissionMode="Custom">
           <authorizationPolicies>
            <add policyType="" />
           </authorizationPolicies>
          </serviceAuthorization>
        </behavior>
       </serviceBehaviors>
      </behaviors>

    Regards, Hiren Bharadwa
    Thursday, October 21, 2010 5:36 AM
  • Hi,

    I always receive the same message and I'm unable to reference the service.
    Well, the only client capable of consuming it is the Silverlight client which I started as normal and the app is running and consuming this service since almost 3 years now.

    The client consuming the service can be found here : http://gearworld.dyndns.org:8082 
    The service is here http://gearworld.dyndns.org:8082/GearService.svc

     
    Part of the Web.Config that enables the Metadata is as this :

    <behaviors>
    	<serviceBehaviors>
    		<behavior name="GearSite.Web.GearServiceBehavior">
    			<serviceMetadata httpGetEnabled="true"/>
    			<serviceDebug includeExceptionDetailInFaults="true"/>
    			<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
    		</behavior>
    	</serviceBehaviors>
    </behaviors>
    <services>
    	<service behaviorConfiguration="GearSite.Web.GearServiceBehavior" name="GearSite.Web.GearService">
    		<endpoint address="" binding="basicHttpBinding" bindingConfiguration="MaximumByteForImage" contract="GearSite.Web.IGearService">
    			<identity>
    				<dns value="localhost"/>
    			</identity>
    		</endpoint>
        <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
      </service>
    </services>
    system.serviceModel>
    

    By code I have this so the client knows where to find the EndPoint 

    if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
    {
        Uri address = new Uri(Application.Current.Host.Source, "../GearService.svc");
        _Proxy = new ProxyCode.GearServiceClient("BasicHttpBinding_IGearService", address.AbsoluteUri);
        _IsGear = _Proxy.Endpoint.Address.Uri.AbsoluteUri.IndexOf("localhost") != -1;
    }
    

     




    • Edited by GearWorld Sunday, October 30, 2011 11:06 AM
    Sunday, October 30, 2011 10:47 AM
  • resolved @ http://social.msdn.microsoft.com/Forums/vstudio/en-US/b790c2bc-71b1-4e4d-8b4e-ebf67ad07dde/metadata-publishing-for-this-service-is-currently-disabled?forum=wcf

    HydPhani

    Thursday, July 31, 2014 1:23 PM