我正在使用两个绑定 TCP 和 HTTP。我想提供两个绑定的mex数据。我想要的是 mexHttpBinding 只公开 HTTP 服务,而 mexTcpBinding 只公开 TCP 服务。或者这可能是我只从 HTTP 绑定和TCP的eventLogging服务访问统计服务吗?
例如:
对于 TCP,我应该只有
net.tcp://localhost:9001/ABC/mex net.tcp://localhost:9001/ABC/eventLogging
对于 HTTP
http://localhost:9002/ABC/stats http://localhost:9002/ABC/mex
当我连接到任何基地址(使用 WCF 测试客户端)时,我能够访问所有服务吗?就像我连接net.tcp://localhost:9001/ABC时一样,我可以使用 HTTP 绑定提供的服务。为什么呢?
<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>