FIX: WCF Metadata not published

Ever faced this problem? No matter whatever you try, your WCF service metadata just wouldn’t get exposed. The basic steps (which you must have already tried) is to enable mex end point,

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

 

 set the behaviors,

    <behaviors>

      <serviceBehaviors>

        <behavior name="mexBehavior">

          <serviceMetadata httpGetEnabled="true" />

        </behavior>

      </serviceBehaviors>

    </behaviors>

 

 and point your service to use the above behavior.

<service name="xxx.yyyService" behaviorConfiguration="mexBehavior">

 

If you have done all of the above and still have the problem, the culprit could be the svc file. Open the .svc file for your service by right clicking on the service > View markup. Check whether the Service tag of the svc file has the fully qualified name of the service including the namespace. Then make sure in the web.config, your service name and the endpoint contract also has the fully qualified name. If not, this should solve your issue.