March 2008 - Posts

NetNamedPipeBinding, Named Pipes and Cross-Machine Communication

In the WCF workshops and conversations we have with our customers, I have been asked a number of times whether NetNamedPipeBinding can be used for cross-machine communication. Although the WCF documentation says you can use NetNamedPipeBinding only for on-machine communication, some people refer to some other places where the named pipes protocol is used for cross-machine communication such as SQL Server and then conclude that it should be possible to use the NetNamedPipeBinding for cross-machine communication.

This has also resulted in confusion around the capabilities of the named pipes protocol to the point that some developers have asked me how SQL Server clients use named pipes to talk to the server if named pipes connections cannot cross the machine boundary.

So here is the story. The named pipes protocol enables a client process to talk to a server process on the same machine or another machine across the network. This is how a client configured to use named pipes connects to a SQL Server process on the same machine or a different machine. Now, the things change when we enter the WCF world. A design decision was made by the WCF team to disallow cross-machine communication in the NetNamedPipeBinding. This has been based on customer requests and also because of the existence of the NetTcpBinding, which is fairly similar to the NetNamedPipeBinding in terms of features and configuration. So if you want to talk to another endpoint on the same machine, using NetNamedPipeBinding makes more sense as it is simpler to configure and safer to use.

One can argue that cross-machine communication could have been allowed by using a configuration option on NetNamedPipeBinding or by creating a different binding (NetCrossMachineNamedPipeBinding?!) but as I mentioned earlier, such design decisions has not yet been made.

Posted by Mehran Nikoo | with no comments
Filed under: