WCF NetTcpBinding with mex
wcf
Solution
You need to use the `<serviceMetadata>` element.
<behaviors>
<serviceBehaviors>
<behavior name="metadataSupport">
<!-- Enables the IMetadataExchange endpoint in services that -->
<!-- use "metadataSupport" in their behaviorConfiguration attribute. -->
<!-- In addition, the httpGetEnabled and httpGetUrl attributes publish -->
<!-- Service metadata for retrieval by HTTP/GET at the address -->
<!-- "http://localhost:8080/SampleService?wsdl" -->
<serviceMetadata httpGetEnabled="true" httpGetUrl=""/>
</behavior>
</serviceBehaviors>
</behaviors>
Problem
I'm trying to publish a wcf service using nettcpbinding. I want to publish metadata, using ?wsdl. I added the following line to the config file: ``` <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> ``` but I can't see the wsdl in my browser. what did I do wrong? Thanks. Edit: Here is the relevant part of my config file: ``` <system.serviceModel> <services> <service name="wcfcheck.service1" behaviorConfiguration="wcfcheck.Service1Behavior"> <endpoint address="" binding="netTcpBinding" contract="wcfcheck.Iservice1"/> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> </services> <behaviors> <serviceBehaviors> <behavior name="wcfcheck.Service1Behavior"> <serviceMetadata httpGetEnabled="true" httpGetUrl=""/> <serviceDebug includeExceptionDetailInFaults="true"/> </behavior> </serviceBehaviors> ``` I might not be accessing the right URL. I tried both http://localhost:51159/Service1.svc?wsdl and http://localhost:51159/Service1.svc/mex?wsdl, and without the '?wsdl'.