C# 不同的 WCF 绑定,它们的区别和与其他平台的兼容性
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10849920/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Different WCF Bindings, their differences and compatibility with other platforms
提问by MSUH
I am looking for some good technical details on Topic of WCF bindings, I am interested to know following things.
我正在寻找有关 WCF 绑定主题的一些好的技术细节,我有兴趣了解以下内容。
- List of Different WCF Bindings with its special purpose and limitation.
- Compatibility/Interoperability with other platform like consuming WCF service in Java, PHP client. Which binding is supported and which is not.
- If I want to get/post secure data through service API which binding should I use if client application is in Java or Php ?
- 不同 WCF 绑定列表及其特殊用途和限制。
- 与其他平台的兼容性/互操作性,例如在 Java、PHP 客户端中使用 WCF 服务。支持哪些绑定,哪些不支持。
- 如果我想通过服务 API 获取/发布安全数据,如果客户端应用程序是 Java 或 Php,我应该使用哪个绑定?
I have browsed through different material over internet but it is not in detail and somewhat scattered. Waiting for some good responses.
我已经通过互联网浏览了不同的材料,但它并不详细而且有些分散。等待一些好的回应。
采纳答案by Pranay Rana
Choosing the right WCF binding


- BasicHttpBinding: Basic web service communication. Exposes WCF services as legacy ASMX web services. Used for interoperability. No security by default.
- WSHttpBinding: Web services with WS-* support. Supports transactions and reliable messaging.
- WSDualHttpBinding: Web services with duplex contract and transaction support.
- WSFederationHttpBinding: Web services with federated security. Supports transactions.
- MsmqIntegrationBinding: Communication directly with MSMQ applications. Supports transactions.
- NetMsmqBinding: Communication between WCF applications by using queuing. Supports transactions.
- NetNamedPipeBinding: Communication between WCF applications on same computer. Supports duplex contracts and transactions.
- NetPeerTcpBinding: Communication between computers across peer-to-peer services. Supports duplex contracts.
- NetTcpBinding: Communication between WCF applications across computers. Supports duplex contracts and transactions.
- BasicHttpBinding:基本的 Web 服务通信。将 WCF 服务公开为旧的 ASMX Web 服务。用于互操作性。默认没有安全性。
- WSHttpBinding:具有 WS-* 支持的 Web 服务。支持事务和可靠的消息传递。
- WSDualHttpBinding:具有双工契约和事务支持的 Web 服务。
- WSFederationHttpBinding:具有联合安全性的 Web 服务。支持交易。
- MsmqIntegrationBinding:直接与 MSMQ 应用程序通信。支持交易。
- NetMsmqBinding:WCF 应用程序之间使用队列进行通信。支持交易。
- NetNamedPipeBinding:同一台计算机上的 WCF 应用程序之间的通信。支持双工合约和交易。
- NetPeerTcpBinding:跨对等服务的计算机之间的通信。支持双工合约。
- NetTcpBinding:跨计算机的 WCF 应用程序之间的通信。支持双工合约和交易。
回答by Pranay Rana
If you are required to create a binding that is globally inter-operable, use
httpbinding.For internal use, but consumers are in separate servers use
tcpbinding. It less inter-operable, but using binary encoding which is faster.Use
named pipebinding for intra-server communication, that is for consumers hosted in same servers. Named pipe binding is the fastest one in wcf allowed bindings.
如果需要创建可全局互操作的
http绑定,请使用绑定。供内部使用,但消费者在单独的服务器上使用
tcp绑定。它的互操作性较差,但使用速度更快的二进制编码。将
named pipe绑定用于服务器内通信,即用于托管在同一服务器中的消费者。命名管道绑定是 wcf 允许的绑定中最快的。
Use bindings appropriately, make your project best.
适当地使用绑定,使您的项目最好。

