wcf仅通过.config更改客户端绑定 [英] wcf change client binding only by .config

查看:131
本文介绍了wcf仅通过.config更改客户端绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何仅通过.config

How I can change wcf client binding only by .config

推荐答案

添加自定义绑定配置节点并在端点绑定节点中引用它来更改wcf客户端绑定.下面的示例应为您提供一个起点.我建议您使用WCF配置编辑器来编辑您的配置文件,因为它将创建正确的语法. (该编辑器位于.NET 3.0 SDK中). 有关WCF配置编辑器的更多信息 [
Add a custom binding configuration node and reference it in the endpoint binding node. The example below should give you a starting point. I recommend editing your con fig file using the WCF configuration editor, since it will create correct syntax. (the editor is in the .NET 3.0 SDK). More info on WCF Configuration editor[^]
<bindings>
    <binding name="MyBinding">
      <textMessageEncoding />
      <tcpTransport />
    </binding>
  </customBinding>

</bindings>
<client>
  <endpoint address="net.tcp://localhost:15020/Myservice"

    behaviorConfiguration="NewBehavior" binding="MyBinding"

    bindingConfiguration="MyBinding; contract="MyContract" name="MyEndpointt" />
  <endpoint address="net.tcp://localhost:15021/Myservice"

    binding="" bindingConfiguration="netTcp2" contract="MyServiceContract"

    name="MyService" />
</client>


这篇关于wcf仅通过.config更改客户端绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆