WCF - net.pipe vs. net.tcp vs. http Bindings

WCF - net.pipe vs. net.tcp vs. http Bindings

问题:

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

net.pipe
net.tcp
http

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

答案:

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

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

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

WCF - net.pipe vs. net.tcp vs. http Bindings

Source: 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 here in the wayback machine if the link no longer works for you).

what's the difference between net.tcp and TCP protocol?

问题:

I am reading the < Learning WCF > by Michele Leroux Bustamante.

In this book, when it comes tonet.tcp protocol, the author just says TCP instead.

So what's the difference between net.tcp and the famous TCP protocol?

And as in net.msmqnet.pipe, what does the net prefix mean?

Many thanks.

回答:

net.tcp is simply the URI scheme used within Windows to identify endpoints that can be accessed using TCP.

Similarly, net.msmq and net.pipe, are the URI schemes to address endpoints that utilise the MSMQ protocol and Named Pipes protocol, respectively.

The net prefix on all three indicates that the URI scheme was devised solely for use on the Microsoft .NET platform and is not generally accepted in the wider internet. (Other URI schemes, such as httpand ftp have have generally accepted meanings and are therefore utilised within WCF without any prefix). The net prefix therefore serves as an warning bell that the associated endpoint will have limited/no interoperability with other applications that are not running on the .NET platform.

Example URIs:

net.tcp://localhost:7272
net.msmq://somemachine/publicQueue
net.pipe://machine.domain.com/somePipe

SIDEBAR: While MSMQ and Named Pipes are clearly Microsoft protocols and therefore a lack of interoperability is unsurprising, TCP is the foundation protocol of the internet and therefore, surely it's use in WCF should not be .NET specific?

Well, interoperability in WCF is already handled by SOAP and HTTP, which both run on top of TCP. If you want interoperability over TCP - use one of those protocols.

Microsoft was therefore looking to provide a communication alternative where performance, rather than interoperability, was the key objective. TCP was the logical choice, but TCP is a relatively low level protocol, which requires additional behavior and defaults to be implemented in order to work in a straight-forward manner for a messaging framework like WCF. In addition, there is no generally accepted URI scheme for TCP accessible resources and therefore Microsoft needed to invent one. Thus, net.tcp was born.


While the URIs themselves don't necessarily indicate exactly which binding to use, they do provide a hint. As per Simon Mourier's answer, the bindings currently available within WCF can be found here. So, for instance, a net.tcp address could indicate that NetTcpBinding, NetPeerTcpBinding, or NetTcpContextBinding is required.

上一篇:【动态规划】滚动数组的求解(C++)


下一篇:Linux安装git和maven的详细过程