WCF service with Named Pipe Binding on multiple sites in IIS7

A named pipe is a system kernel object that processes on the same server may use for communicating with each other. It is a fast, secure, and reliable way for your applications to access on-machine WCF services.

While working on the test server that hosted multiple sites in IIS7 (test, uat, staging, etc.), I have noticed that for a single web service all sites used the same named pipe - you can look at all named pipes defined on your system using a tool like PipeList. Needless to say, reusing the same named pipe is not a desirable behavior in this situation.

I looked closer into the issue. From what I now understand, WCF uses an algorithm that maps a service path to the pipe name. By default, this algorithm ignores the domain name of the site and, thus, all sites on the server map services with the same local path to the same named pipes.

That explain the root cause of the issue. How can we get it fixed? How can we force the algorithm to take the domain name into acount when creating a named pipe?


The first step is to set the hostNameComparisonMode attribute to Exact in the NetNamedPipeBinding configuration of your service:

<netNamedPipeBinding>

    <binding  name="YourNamedPipeBinding"  hostNameComparisonMode="Exact" />

</netNamedPipeBinding>


The second step is to modify the net.pipe binding on each IIS7 website:

Named Pipe Binding Information


Hope it helps. Happy coding!

Welcome to ModelBlog

Thank you for visiting ModelBlog. We hope the time you spend with us will be both entertaining and worth your while. Have fun!

Authors

Search

Archive

Tags