【发布时间】:2011-05-24 18:34:00
【问题描述】:
我的 Windows 服务托管 WCF 服务具有以下配置:
<services>
<service name="MyService" behaviorConfiguration="MyServiceBehavior">
<endpoint address=""
binding="netTcpBinding"
bindingConfiguration="WindowsClientOverTcp"
name="WindowsClientOverTcp"
contract="IMyService" />
<endpoint address=""
binding="wsHttpBinding"
bindingConfiguration="WindowsClientOverHttps"
name="WindowsClientOverHttps"
contract="IMyService">
</endpoint>
<endpoint address="mex"
binding="mexTcpBinding"
contract="IMetadataExchange" />
<endpoint address="mex"
binding="mexHttpsBinding"
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="https://MyMachine:8250/Services/MyService/Https" />
<add baseAddress="net.tcp://MyMachine:8250/Services/MyService/tcp" />
</baseAddresses>
</host>
</service>
1st:一切正常。不过我有一个问题。当开始在 VS.NET 2010 中调试服务并出现“WCF 测试客户端”工具时,树的顶部仅显示单个“net.tcp://MyMachine:8250/Services/MyService/tcp”地址导航,并且两个端点都显示为子元素(WindowsClientOverTcp 和 WindowsClientOverHttps)。现在两个基地址都是消耗品和可用,所以没有大问题。但是,为什么它只显示工具中的单个地址?我认为这可能是 .config 中显示的顺序,所以我切换了它们,但这并没有改变任何东西。
有谁知道当一个服务暴露多个端点时,为什么两个基地址都没有显示在 WCF 测试客户端工具中?
谢谢!
【问题讨论】:
-
好吧,补充一下,我了解显示单个地址的原因。它与我要公开的 mex 端点有关。我可能只需要一个服务的元数据端点,mex http 端点就足够了(我认为)。根据我在 .config 中实际拥有 mex 端点的顺序(永远是第一个),确定 WCF 测试客户端的根中显示哪个端点地址。
标签: .net wcf visual-studio-2010 debugging