Click here to Skip to main content
13,091,548 members (68,656 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
I have created WCF service hosted on IIS. I get the following error when browse the service.

Metadata publishing for this service is currently disabled.

Here is the code for web.config

<?xml version="1.0"?>
<configuration>
    <system.web>
        <compilation debug="true" targetFramework="4.0"/>
    </system.web>
    <system.serviceModel>
        <services>
            <service behaviorConfiguration="ServiceBehavior" name="IISHostedServiceEx1.MyService">
                <endpoint address="http://localhost/IISHostedServiceEx1/MyService.svc" binding="wsHttpBinding" contract="IMyService">
                    <identity>
                        <dns value="localhost"/>
                    </identity>
                </endpoint>
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
            </service>
        </services>
        <behaviors>
            <serviceBehaviors>
                <behavior name="ServiceBehavior">
                    <!-- To avoid disclosing metadata information,
    set the value below to false and remove the
    metadata endpoint above before deployment -->
                    <serviceMetadata httpGetEnabled="true"/>
                    <!-- To receive exception details in faults for
    debugging purposes, set the value below to true.
    Set to false before deployment to avoid disclosing exception information -->
                    <serviceDebug includeExceptionDetailInFaults="false"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>
    </system.serviceModel>
 

    <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
    </system.webServer>
</configuration>


Can any body tell me how can i resolve it?

thanks in advance.
Posted 18-Jan-13 5:38am
Updated 26-Jul-16 22:46pm
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Right click on your service reference and click configure and un-check "Reuse Types in Referenced Assemblies".
Second thing you need to have one extra endpoint ImetaDataExchange, If its not there then add in web.config.
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

I believe the problem is the address you're using for the wsHttpBinding element.
Generally, there's no need to specify the address, unless you actually want it to run in a subaddres of the actual .svc file, as below:

<system.serviceModel>
  <services>
    <service behaviorConfiguration="ClientProcessadorEventos" name="ClienteExternoWS.ClientProcessadorEventos">
      <endpoint address="mex" binding="mexHttpBinding" name="Mex" contract="ServiceInterfaces.IProcessadorEventos"/>
      <endpoint address="basic" binding="basicHttpBinding" name="Basic" contract="ServiceInterfaces.IProcessadorEventos"/>
      <endpoint address="" binding="wsHttpBinding" name="Ws" contract="ServiceInterfaces.IProcessadorEventos"/>
    </service>
  </services>
  <behaviors>
    <serviceBehaviors>
      <behavior name="ClientProcessadorEventos">
        <serviceMetadata httpGetEnabled="true"/>
      </behavior>
    </serviceBehaviors>
  </behaviors>
</system.serviceModel>


In this case, my service exposes the same contract on the pure .svc address (root, as the address is not specified), and it also exposes as basicBinding on the [ServiceName].svc/Basic address.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 27 Jul 2016
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100