【发布时间】:2010-12-25 16:26:36
【问题描述】:
它会消耗所有这些吗? 会抛出异常吗?
【问题讨论】:
标签: .net wcf wcf-client endpoints
它会消耗所有这些吗? 会抛出异常吗?
【问题讨论】:
标签: .net wcf wcf-client endpoints
您可以在客户端配置中为同一个合约和不同地址设置多个端点,没问题。
它们需要由 <endpoint> 标记上的唯一 name= 属性分隔。
<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");
您不能再只是实例化您的客户端并期望它找到要使用的“那个”端点,因为有多个(不幸的是,如果没有指定,则无法将一个定义为“默认”) .
除此之外,我认为不会出现任何问题。
【讨论】: