0

我有一个 app.config。

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
    <bindings>
        <wsHttpBinding>
          <binding name="WsIGetHeaders" />
        </wsHttpBinding>
      <netTcpBinding>
        <binding name="TcpIGetHeaders" />
      </netTcpBinding>
    </bindings>
    <client>
        <endpoint address="http://localhost:8731/Design_Time_Addresses/DemoService/HeaderService/"
            binding="wsHttpBinding" bindingConfiguration="WsIGetHeaders"
            contract="DemoService.IGetHeaders" name="WsIGetHeaders">
        </endpoint>
      <endpoint address="net.tcp://localhost:8731/Design_Time_Addresses/DemoService/HeaderService/"
          binding="netTcpBinding" bindingConfiguration="TcpIGetHeaders"
          contract="DemoService.IGetHeaders" name="TcpIGetHeaders">
      </endpoint>
    </client>
</system.serviceModel>
</configuration>

我们知道绑定名称必须与 bindingConfiguration 匹配,但是客户端部分中的端点名称如何。我用黑色的笔圈了起来。红色的相互匹配。有msdn吗? 图片

4

1 回答 1

0

端点名称用于客户端配置,以便稍后在创建客户端实例时在代码中匹配。一些信息可以在这里找到。将服务客户端代理对象构造为从 ClientBase 派生的每个代理类的示例,该类具有适当的ctor

 client = new ServiceClient(useSecure ? "SecureEndpoint" : "defaultEndpoint");
于 2013-08-28T19:41:13.523 回答