WCF NamedPipe Only

Here is a simple example of my problem. I am writing an application in which self hosts a WCF service for communication only in a user session. When several users simultaneously run this application on a Terminal Services machine, all users are satisfied as long as they do not have local administrative rights. The problem begins if two or more users are admins, the first user creates the service, the second user because the service was created globally ...

A simple Win32 implementation without WCF will create a named pipe with the local prefix. First, WCF tries to create a global shared memory mapping, then fails, and then creates a local mapping.

Has anyone found a way to host the WCF service, which is local to the current user session, even if the user is a local administrator?

+4
source share
1 answer

The easy way is only for each instance to use a different service URL (getting it from some characteristic of the user session to make it unique - for example, the session login ID).

It is not possible to stop WCF binding by publishing its endpoint data (also the name of the real channel) in the global namespace if it works with sufficient privileges to do so. But perhaps you can set up process token privileges to disable SeCreateGlobalPrivilege before opening the service host if your service discovers that it is running as an administrator with elevated privileges.

+1
source

All Articles