WaitHandleCannotBeOpenedException: No handle of the given name exists. RRS feed

  • Question

  • I use Windows 7 64Bit and VisualStudio 2008

    I create an event in a service which is running under local system account

    EventWaitHandleSecurity sec = new EventWaitHandleSecurity();
    sec.AddAccessRule(new EventWaitHandleAccessRule(@"Authenticated Users", EventWaitHandleRights.FullControl, AccessControlType.Allow));
    sec.AddAccessRule(new EventWaitHandleAccessRule(@"Everyone", EventWaitHandleRights.FullControl, AccessControlType.Allow));
    EventWaitHandle myEvent = new EventWaitHandle(true, EventResetMode.ManualReset, "testevent", out created, sec);

    If I try to open this event in an other service it works well.

    If I try to open this event with a program which is running in an account of in logged in user, I get always an exception.
    EventWaitHandle event = EventWaitHandle.OpenExisting("testevent", EventWaitHandleRights.Synchronize);

    System.Threading.WaitHandleCannotBeOpenedException: No handle of the given name exists.

    What I had to do to open this event in an account on an logged in user?

    Friday, November 13, 2009 4:54 PM


All replies