Wcf – Where is wsdl file in WCF service

wcfweb serviceswsdl

I have created a WCF web service and locally when I access the wsdl file like (http://localhost/myservice/service.svc?wsdl it shows the wsdl file just fine. I then uploaded it to my virtual server hosted by GoDaddy and when I call http://my ip address:myport/service.svc?wsdl the result is the page where it states "You have created a service". This is the same page that displays when I call the same url but without the ?wsdl (http://my ip address:myport/service.svc). How can I get at my wsdl file on the virtual server? Why did this happen differently than my local machine?

Best Answer

Make sure that your config file in hosting environment allows retrieving the WSDL document. It should contain this:

<behaviors>
  <serviceBehaviors>
    <behavior name="metadata">
      <serviceMetadata httpGetEnabled="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>

And reference this behavior in your service configuration.

Edit:

Just to make it clear. With default WCF behavior, the WSDL file is nowhere. It is auto-generated and this auto-generation must be allowed.