Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF with named pipe under different user sessions

Tags:

pipe

session

wcf

I have an application that can be active simultaneously under different user sessions on the same box. It consists of a client and a server, both running under the interactive user and communicating via WCF over named pipes.

If I create a WCF server listening on, say, "net.pipe://localhost/MyService" ... two instances of the server process cannot exist under the same user session, but WCF allows two servers using this same base address under the different user sessions.

Here are my questions;

  • if WCF does not use the URI as the pipe name, how does the client find the server?

  • how does WCF keep two instances of my server, running under different user sessions, from interfering from each other? (e.g. client under user session 'A' always communicates with server under user session 'A' and never the server running under user session 'B')

Thanks in advance.

like image 686
john Avatar asked Nov 01 '22 06:11

john


1 Answers

WCF generates a GUID and uses that as the name for the named pipe.

The URI is used to derive the location of a shared memory object. The server will actually create that shared memory object with the GUID of the named pipe to use. The client will read the shared memory object to obtain the GUID.

This shared memory object is constrained to the user session. A different user session means a different named pipe.

References:

http://blogs.msdn.com/b/rodneyviana/archive/2011/03/22/named-pipes-in-wcf-are-named-but-not-by-you-and-how-to-find-the-actual-windows-object-name.aspx

https://stackoverflow.com/a/10342690/107177

like image 193
Onots Avatar answered Nov 15 '22 05:11

Onots