Can I access a mutex created by a windows service from a user application?
I'开发者_如何学运维m creating a named mutex in a windows service that needs to be accessible from regular applications. So far I create the mutex with a name similar to Global\< GUID >.
Right now I get an unauthorized access violation when I try to open the mutex from an application. How do I configure the mutex at creation time to allow access to any process in the system?
You need to use Mutex.SetAccessControl Method to set the desired access rights on it. There is an example at What is a good pattern for using a Global Mutex in C#?
精彩评论