When I test it, I start the executable first and then the service. If the
executable is running as an administrator, there is no problem. If it is a
normal user, the service will fail to open the existing event.
( If I start the service first, then the program as a normal user, then the
program will fail at an earlier stage, when a mutex is created with mutex =
new System.Threading.Mutex(false, "MyMutexName"); )
The code I use is taken from the help on the
EventWaitHandle.SetAccessControl method. I took Main, made it a public static
method with the name as an inparam and removed the deny rule on Synchronize
and Modify when the named event is created.
So, I guess the problem is to figure out how to give the normal user access
to work with a named Mutex/EventWaitHandle...
- Kristoffer -
"Vadym Stetsyak" wrote:
Hello, Kristoffer!
KP> I'm trying to use a named EventWaitHandle to signal events between
KP> processes that run on the same computer. One of them is a service
KP> running as SYSTEM and the other one is a normal user. Creating the
KP> handle seems to be no problem, but when the other process is calling
KP> EventWaitHandle.OpenExisting with the same name, an
KP> UnauthorizedAccessException is thrown with the message "Access to the
KP> path is denied.".
What process is calling EventWaitHandle.OpenExisting? Service or application under common user?
Can you post code, where you create and initialize EventWaitHandle object?
--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot