【发布时间】:2011-07-14 17:10:41
【问题描述】:
我有这个自托管服务。在 app.config 中,我定义了两个基地址。一个用于 http,一个用于 net.tcp。
一个合约通过两个端点公开,一个带有 basicHttpBinding,另一个带有 netTcpBinding。
现在,奇怪的是两个端点在两个基地址上都可用。如果我使用 wcfclient.exe 应用程序连接到任一端点,则两个端点都会显示。即在 net.tcp 上的 basicHttpBinding 和其他方式。
为什么会这样,我能做些什么吗?
供参考的配置。
<configuration>
<system.serviceModel>
<services>
<service name="FileServer.BookService" behaviorConfiguration="serviceMetadata">
<host>
<baseAddresses>
<add baseAddress="http://localhost"/>
<add baseAddress="net.tcp://localhost"/>
</baseAddresses>
</host>
<endpoint address="BookService"
binding="netTcpBinding"
contract="FileServer.IBookService">
</endpoint>
<endpoint address="BookService/mex"
binding="mexTcpBinding"
contract="IMetadataExchange">
</endpoint>
<endpoint address="BookService"
binding="basicHttpBinding"
contract="FileServer.IBookService">
</endpoint>
<endpoint address="BookService/mex"
binding="mexHttpBinding"
contract="IMetadataExchange">
</endpoint>
<endpoint address="basic"
binding ="basicHttpBinding"
contract="FileServer.ITest">
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="serviceMetadata">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
【问题讨论】: