Note that there are some explanatory texts on larger screens.

plurals
  1. POmexTcpBinding in WCF - IMetadataExchange errors
    text
    copied!<p>I'm wanting to get a WCF-over-TCP service working. I was having some problems with modifying my own project, so I thought I'd start with the "base" WCF template included in VS2008.</p> <p>Here is the initial WCF App.config and when I run the service the WCF Test Client can work with it fine:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;configuration&gt; &lt;system.web&gt; &lt;compilation debug="true" /&gt; &lt;/system.web&gt; &lt;system.serviceModel&gt; &lt;services&gt; &lt;service name="WcfTcpTest.Service1" behaviorConfiguration="WcfTcpTest.Service1Behavior"&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="http://localhost:8731/Design_Time_Addresses/WcfTcpTest/Service1/" /&gt; &lt;/baseAddresses&gt; &lt;/host&gt; &lt;endpoint address="" binding="wsHttpBinding" contract="WcfTcpTest.IService1"&gt; &lt;identity&gt; &lt;dns value="localhost"/&gt; &lt;/identity&gt; &lt;/endpoint&gt; &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/&gt; &lt;/service&gt; &lt;/services&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name="WcfTcpTest.Service1Behavior"&gt; &lt;serviceMetadata httpGetEnabled="True"/&gt; &lt;serviceDebug includeExceptionDetailInFaults="True" /&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;/system.serviceModel&gt; &lt;/configuration&gt; </code></pre> <p>This works perfectly, no issues at all.</p> <p>I figured changing it from HTTP to TCP would be trivial: change the bindings to their TCP equivalents and remove the httpGetEnabled serviceMetadata element:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;configuration&gt; &lt;system.web&gt; &lt;compilation debug="true" /&gt; &lt;/system.web&gt; &lt;system.serviceModel&gt; &lt;services&gt; &lt;service name="WcfTcpTest.Service1" behaviorConfiguration="WcfTcpTest.Service1Behavior"&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="net.tcp://localhost:1337/Service1/" /&gt; &lt;/baseAddresses&gt; &lt;/host&gt; &lt;endpoint address="" binding="netTcpBinding" contract="WcfTcpTest.IService1"&gt; &lt;identity&gt; &lt;dns value="localhost"/&gt; &lt;/identity&gt; &lt;/endpoint&gt; &lt;endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/&gt; &lt;/service&gt; &lt;/services&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name="WcfTcpTest.Service1Behavior"&gt; &lt;serviceDebug includeExceptionDetailInFaults="True" /&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;/system.serviceModel&gt; &lt;/configuration&gt; </code></pre> <p>But when I run this I get this error in the WCF Service Host:</p> <p>System.InvalidOperationException: The contract name 'IMetadataExchange' could not be found in the list of contracts implemented by the service Service1. Add a ServiceMetadataBehavior to the configuration file or to the ServiceHost directly to enable support for this contract.</p> <p>I get the feeling that you can't send metadata using TCP, but that's the case why is there a mexTcpBinding option?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload