WCF Metadata Exchange with TCP

by Marc 9. January 2008 13:38

From the "searching seems a little bit devoid of info on this" list of technical tips:

So, how do you enable Metadata exchange for TCP services? Your config file on the server side should look something like this (in this case I have a Duplex service), with the important bit being the additional 'mexTcpBinding' endpoint:

  <system.serviceModel>
    
    <services>
      <service name="MyService" behaviorConfiguration="standard">
        <endpoint address="net.tcp://localhost:1010/myservice"
                  binding="netTcpBinding"
                  bindingConfiguration="DuplexBinding"
                  contract="IMyService"/>
        <endpoint address="mex"
                  binding="mexTcpBinding"
                  contract="IMetadataExchange"/>
      </service>
    </services>

    <behaviors>
      <serviceBehaviors>
        <behavior name="standard">
          <serviceThrottling maxConcurrentSessions="10000"/>
          <serviceMetadata policyVersion="Policy15"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <bindings>
      <netTcpBinding>
        <binding name="DuplexBinding" sendTimeout="00:00:01">
          <reliableSession enabled="true"/>
          <security mode="None"/>
        </binding>
      </netTcpBinding>
    </bindings>
    
  </system.serviceModel>

Now you can update your client configuration with a Service Reference, and then refresh as required (so long as the server is running) using Service References -> Update Reference. Ultimately, I'd probably recommend rolling your own app.config for the client, though you can typically use the generated config as a starter.

Technorati Tags: , ,

Tags:

Architecture | Services

blog comments powered by Disqus