4

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?

Nathanael
  • 1,782
  • 17
  • 25
  • 1
    Have you looked into using the constructor that lets you set access permissions? http://msdn.microsoft.com/en-us/library/9zf2f5bz.aspx – Jim Mischel Apr 07 '11 at 17:30

1 Answers1

7

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#?

Community
  • 1
  • 1
Giorgi
  • 30,270
  • 13
  • 89
  • 125