Creating a Cross-Process EventWaitHandle c#

Posted by Navaneeth on Stack Overflow See other posts from Stack Overflow or by Navaneeth
Published on 2010-04-07T06:06:38Z Indexed on 2010/04/07 6:13 UTC
Read the original article Hit count: 1262

Filed under:
|
|
|

Hello all,

I have two windows application, one is a windows service which create EventWaitHandle and wait for it .Second application is a windows gui which open it by calling EventWaitHandle.OpenExisting() and try to Set the event .But I am getting an exception in OpenExisting .The Exception is "Access to the path is denied".

windows Service code

EventWaitHandle wh = new EventWaitHandle(false, EventResetMode.AutoReset, "MyEventName");
wh.WaitOne();

Windows GUI code

        try
        {
            EventWaitHandle wh = EventWaitHandle.OpenExisting("MyEventName");
            wh.Set();
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }

I tried the same code with two sample console application ,it was working fine.

Looking forward to hearing from you

© Stack Overflow or respective owner

Related posts about c#

Related posts about synchronization