Mikee
Mikee

Reputation: 646

WCF - auto generated WSDL not working

I have a WCF service MyService.svc, hosted in IIS 7. The service is configured like this:

<system.serviceModel>
  <services>
      <service name="MyService">
          <endpoint address="" binding="basicHttpBinding" contract="MyPortType"></endpoint>
      </service>
  </services>
  <behaviors>
      <serviceBehaviors>
          <behavior name="defaultBehaviour">
              <serviceMetadata httpGetEnabled="true"  />
              <serviceDebug includeExceptionDetailInFaults="true" />
          </behavior>
      </serviceBehaviors>
  </behaviors>
</system.serviceModel>

The problem is, that my service do not offer autogenerated WSDL (adding ?wsdl to the URL of service), despite the fact that I included tag

 <serviceMetadata httpGetEnabled="true"  />

The service itself is working, if I try to call it via SoapUI. When I try to access WSDL, i get HTTP Error 400 and no WSDL in response.

It is important to note that I'm using .NET 3.5 and Visual studio 2008 for legacy reasons (it is an old app). Data Contract is generated via command line using svcutil.exe from VS2008. When I tried same service and same configuration under VS 2013/.NET 4.5 (regenerad data contract classes with svcutil.exe from VS2013), autogenerated WSDL appears with no problem.

What can I do do get autogenerated WSDL working under .NET 3.5/VS2008?

Thank you, Michal

Upvotes: 1

Views: 897

Answers (2)

Yuri S
Yuri S

Reputation: 5370

Add metadata endpoint to service

<services>
      <service name="MyService">
          <endpoint address="" binding="basicHttpBinding" contract="MyPortType"></endpoint>
     <endpoint address=”mex” binding=”mexHttpBinding” contract=”IMetadataExchange”/>
   </service>
</services>

Upvotes: 1

Chris
Chris

Reputation: 2481

if you remove the name of your behaviour, it should pick it up.

   <serviceBehaviors>
      <behavior name="defaultBehaviour">
          <serviceMetadata httpGetEnabled="true"  />
          <serviceDebug includeExceptionDetailInFaults="true" />
      </behavior>
  </serviceBehaviors>

to

      <serviceBehaviors>
      <behavior>
          <serviceMetadata httpGetEnabled="true"  />
          <serviceDebug includeExceptionDetailInFaults="true" />
      </behavior>
  </serviceBehaviors>

Upvotes: 0

Related Questions