[ACCEPTED]-WCF hosting: Can access svc file but cannot go to wsdl link-wsdl

Accepted answer
Score: 24

had the same problem. i fixed it by adding 4 httpsGetEnabled to serviceBehaviors>behavior 3 like this:

<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>

maybe it helps someone else. dont 2 think that u need this hint after 4years 1 =)

Score: 18

You basically need three things to enable 9 browsing to your WSDL for a WCF service:

  1. a service behavior which enables service metadata
  2. set the httpGetEnabled=True on that service metadata behavior to allow http browsing to that metadata
  3. a mex endpoint on your service

So 8 your config on the server side might looks 7 something like this (plus a bit more stuff):

  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MetadataBehavior">
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <services>
      <service behaviorConfiguration="MetadataBehavior" name="YourService">
        <endpoint address="" 
                  binding="basicHttpBinding" 
                  contract="IYourService" />
        <endpoint address="mex" 
                  binding="mexHttpBinding" 
                  contract="IMetadataExchange" />
      </service>
    </services>
  </system.serviceModel>

Points 6 1 and 2 are handled by this line here:

<serviceMetadata httpGetEnabled="true" />

You 5 need to reference that service behavior 4 in your <service> tag for it to become active.

Point 3 3 (MEX endpoint) is this section here:

<endpoint address="mex" 
          binding="mexHttpBinding" 
          contract="IMetadataExchange" />

For 2 http, use the mexHttpBinding, and the IMetadataExchange contract is a WCF 1 system contract for metadata exchange .

Score: 3

I know that answer it's so late but I had 6 the same problem and the solution was:

Add 5 tags [ServiceContract] and [OperationContract] on interface that it is implemented 4 on service .svc. Visual Studio create interface 3 when you select WCF Service but I deleted the interface 2 and I created my own interface.

[ServiceContract]
public interface IService1
{
    [OperationContract]
    void DoWork();
}

I hope to 1 help somebody.

More Related questions