问题
I have a client app that hosts a WCF service using net.pipe protocol. The client can't communicate with other WCF services which are running under the admin user.
I have read that you can't communicate using net.pipe between different users.
Is there way to by pass it?
回答1:
I have read that you can't communicate using net.pipe between different users.
This isn't true in general. Here is a summary of what I think you are referring to:
If you are running on an operating system earlier than Windows Vista there is no problem: any process should be able to host a WCF net.pipe service accessible to any other local process.
If you are running on Windows Vista or later, a WCF net.pipe service will only be accessible to processes running in the same logon session (e.g. within the same interactive user's session) unless the process hosting the WCF service is running with the elevated privilege SeCreateGlobalPrivilege.
Windows Services run in their own logon session, and have the privilege SeCreateGlobalPrivilege, so self-hosted and IIS-hosted WCF net.pipe services are visible to processes in other logon sessions on the same machine.
In most scenarios I have come across where this is an issue, the workaround is to always host the WCF service in a Windows Service, using a duplex contract if necessary to reverse the client and server roles during an interaction session.
See also:
- Minimum OS Permissions required to create named pipe (WCF)
- Getting EndpointNotFoundException with NetNamedPipeBinding in C#; Need To Create Global Named Pipe
- Connecting via named pipe from windows service (session#0) to desktop app (session #1)
来源:https://stackoverflow.com/questions/12072617/client-on-non-admin-user-cant-communicate-using-net-pipe-with-services