它会消耗所有这些吗?它会抛出异常吗?
问问题
4480 次
1 回答
11
您可以在客户端配置中为同一合约和不同地址设置多个端点,没问题。
它们需要由标签name=
上的唯一属性分隔。<endpoint>
<client>
<endpoint name="tcpEndpoint"
address="net.tcp://server:8888/SomeService"
binding="netTcpBinding"
contract="IYourService" />
<endpoint name="httpEndpoint"
address="http://server:8777/SomeService"
binding="basicHttpBinding"
contract="IYourService" />
</client>
创建客户端代理时,您需要提供要使用的端点的名称:
YourClient client = new YourClient("netTcpEndpoint");
您不能再仅仅实例化您的客户端并期望它找到要使用的“该”端点,因为有多个端点(不幸的是,如果没有指定,则无法将一个定义为“默认”)。
除此之外 - 我认为不会出现任何问题。
于 2009-12-11T14:01:03.063 回答