WCF and IIS 6 – WSDL is not exposed

iisiis-6wcfwsdl

I have developed an ASP.NET application that includes a WCF service. This service needs to be consumed by third party applications. This service has worked fine while testing in my development environment. My development environment is using IIS 7.0 on Window 7 RC 1. However, I cannot use the service once it is in my staging / production environment. My staging / production environment is a Windows Server 2003, IIS 6 environment.

When I attempt to reference the service when it is in the IIS 6 environment, I receive an error that says:

Error: Cannot obtain Metadata

Interesting, I noticed a subtle, but I believe important, difference in my testing an staging/production environments.

In my test environment, I noticed that I can access the Service page via a url with the following template:

http://localhost/MyApp/services/myService.svc

I also noticed that in my test environment, I can see the WSDL information if I visit a url with the following template:

http://localhost/MyApp/services/myService.svc?wsdl

However, in my staging / production environment, I cannot see the WSDL information. Oddly enough, I can see the Service page though.

Here are the configuration settings related to my services in my production environment.

<system.serviceModel>
  <behaviors>
    <serviceBehaviors>
      <behavior name="myServiceBehavior">
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="false" />
      </behavior>
    </serviceBehaviors>
  </behaviors>

  <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
  <services>
    <service behaviorConfiguration="myServiceBehavior" name="myService">
      <endpoint address="" binding="basicHttpBinding" contract="myService" />
      <endpoint address="mex" binding="mexHttpBinding" 
        contract="IMetadataExchange" />
    </service>
  </services>
</system.serviceModel>

Why would I be able to see the Service page but not the WSDL page in the Windows Server 2003 IIS 6.0 environment?

Thank you!

Best Answer

Have you enabled metadata exchange?

    <serviceMetadata httpGetEnabled = "true"/>

Have you defined the metadata exchange endpoint

    <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
      name="mexendpoint" contract="IMetadataExchange" />
Related Topic