net.pipe 与 net.tcp 与 http 绑定

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/765692/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 12:32:56  来源:igfitidea点击:

net.pipe vs. net.tcp vs. http Bindings

.netwcfwcf-binding

提问by Aaron

I'm new to WCF and would like to know the differences/advantages/limitations/etc of each of the following bindings:

我是 WCF 的新手,想知道以下每个绑定的差异/优势/限制/等:

net.pipe
net.tcp
http

Supporting scenarios on when to use each binding and other examples would be appreciated.

关于何时使用每个绑定和其他示例的支持场景将不胜感激。

回答by Joe Doyle

While not great for providing specific usage examples, here is a link from MSDN which lists all the features for the bindings.

虽然不太适合提供特定的使用示例,但这里有一个来自 MSDN 的链接,其中列出了绑定的所有功能。

http://msdn.microsoft.com/en-us/library/ms730879.aspx

http://msdn.microsoft.com/en-us/library/ms730879.aspx

Here is a decent flow chart that can help choosing between them as well.

这是一个不错的流程图,可以帮助您在它们之间进行选择。

Flowchart

流程图

Source: http://bloggingabout.net/blogs/dennis/archive/2006/12/01/WCF-Binding-decision-chart.aspx

来源:http: //bloggingabout.net/blogs/dennis/archive/2006/12/01/WCF-Binding-decision-chart.aspx

Here is a good overall article I've used in the past.

这是我过去使用过的一篇很好的整体文章。

http://mkdot.net/blogs/dejan/archive/2008/03/31/wcf-binding-decision.aspx(or herein the wayback machine if the link no longer works for you).

http://mkdot.net/blogs/dejan/archive/2008/03/31/wcf-binding-decision.aspx(或这里的自由之路机,如果该链接不再为你的作品)。

回答by Nicolas Dorier

net.pipe, fast and secure because your web service is not accessible from the network (typically, you will use net.pipe to interact with a windows service easily).

net.pipe,快速且安全,因为您的 Web 服务无法从网络访问(通常,您将使用 net.pipe 轻松与 Windows 服务交互)。

http, you will use it for interoperability reason, if your web service is not over HTTP, silverlight or flash cannot use it (because the browser filter non-http packets, as a firewall does).

http,出于互操作性原因,您将使用它,如果您的 web 服务不是通过 HTTP,silverlight 或 flash 无法使用它(因为浏览器过滤非 http 数据包,就像防火墙一样)。

net.tcp, is a bit faster because your soap message is not wrapped inside a HTTP request, but you cannot invoke your webservice with a RIA technology, and some firewall will drop your message.

net.tcp,速度稍快一些,因为您的soap 消息没有包含在HTTP 请求中,但是您无法使用RIA 技术调用您的web 服务,并且某些防火墙会丢弃您的消息。

回答by Srikar Doddi

Windows Communication Foundation (WCF) is a framework for building services that process XML messages. WCF allows you to transmit messages using different transport protocols (such as HTTP, TCP, and MSMQ) and using different XML representations (such as text, binary, or MTOM, which is commonly referred to as the message encoding in WCF.

Windows Communication Foundation (WCF) 是用于构建处理 XML 消息的服务的框架。WCF 允许您使用不同的传输协议(例如 HTTP、TCP 和 MSMQ)和使用不同的 XML 表示(例如文本、二进制或 MTOM,这在 WCF 中通常称为消息编码)来传输消息。

If you want to host many WCF Services on one machine and want them to use shared memory for their communication, use a named pipe=>net.pipe, and then use tcp for the communication to WCF Services on different machines.

如果您想在一台机器上托管多个 WCF 服务并希望它们使用共享内存进行通信,请使用命名管道 =>net.pipe,然后使用 tcp 与不同机器上的 WCF 服务进行通信。

Configuration of nettcp binding focuses on creating a channel stack that will perform better in Windows environments, giving you a great option for replacing your various COM+ and .NET remoting investments.

nettcp 绑定的配置侧重于创建在 Windows 环境中性能更好的通道堆栈,为您提供替换各种 COM+ 和 .NET 远程处理投资的绝佳选择。

BasicHttpBinding was designed for scenarios where interoperability is of utmost importance. As a result, BasicHttpBinding uses HTTP for the transport and text for the message encoding.

BasicHttpBinding 专为互操作性至关重要的场景而设计。因此,BasicHttpBinding 使用 HTTP 进行传输,使用文本进行消息编码。