Multiple Base Addresses and Multiple Endpoints in WCF

Posted by mnhab on Stack Overflow See other posts from Stack Overflow or by mnhab
Published on 2010-03-08T07:26:59Z Indexed on 2010/03/08 7:36 UTC
Read the original article Hit count: 810

Filed under:
|
|
|
|

I'm using two bindings TCP and HTTP. I want to give mex data on both bindings. What I want is that the mexHttpBinding only exposes the HTTP services while the mexTcpBinding exposes TCP services only. Or is this possible that I access stats service only from HTTP binding and the eventLogging service from TCP?

For Example:

  • For TCP I should only have

    net.tcp://localhost:9001/ABC/mex
    net.tcp://localhost:9001/ABC/eventLogging
    
  • For HTTP

    http://localhost:9002/ABC/stats
    http://localhost:9002/ABC/mex
    

When I connect with any of the base address (using the WCF Test Client) I'm able to access all the services? Like when I connect with net.tcp://localhost:9001/ABC I'm able to use the services which are offered on the HTTP binding. Why is that so?

<system.serviceModel>
  <services>
    <service behaviorConfiguration="ABCServiceBehavior" name="ABC.Data.DataServiceWCF">
      <endpoint address="eventLogging" binding="netTcpBinding" contract="ABC.Campaign.IEventLoggingService" />
      <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" contract="IMetadataExchange" />
      <endpoint address="stats" binding="basicHttpBinding" contract="ABC.Data.IStatsService" />
      <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      <host>
        <baseAddresses>
          <add baseAddress="net.tcp://localhost:9001/ABC" />
          <add baseAddress="http://localhost:9002/ABC" />
        </baseAddresses>
      </host>
    </service>
  </services>
  <behaviors>
    <serviceBehaviors>
      <behavior name="ABCServiceBehavior">
        <serviceMetadata httpGetEnabled="false" />
        <serviceDebug includeExceptionDetailInFaults="true" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
</system.serviceModel>

© Stack Overflow or respective owner

Related posts about wcf

Related posts about c#