WCF服务程序设计NetTcpBinding与Web配置

时间:2014-08-16 11:30:45

标签: c# .net wcf nettcpbinding

调用我的WCF服务这两种方法有区别吗?

1)程序化绑定:

var xml = "my xml string";
var ep = new EndpointAddress("http://myendpoint");
xml = new Proxy.ServiceClient(new NetTcpBinding(), ep).getNewXML(new Proxy.CallContext(), xml);

2)web配置配置:

var xml = "my xml string";
xml = new Proxy.ServiceClient().getNewXML(new Proxy.CallContext(), xml);

对应的网络配置:

  <system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="NetTcpBinding_SCSService">
        </binding>
      </netTcpBinding>
    </bindings>
    <client>
      <endpoint address="myendpoint"
       binding="netTcpBinding" bindingConfiguration="NetTcpBinding_SCSService"
       contract="SCSProxy.SCSService" name="NetTcpBinding_SCSService">
      </endpoint>
    </client>
  </system.serviceModel>

0 个答案:

没有答案