listen to event raised from application running in windows service
<p>I am trying to listen to event which is raised from application running under a windows service. Below is sample code to demonstrate as what I am after ...</p>

<p>Separate Class library code(classlibrary1.dll)</p>

<pre><code>namespace ClassLibrary1
{
    public class Class1 : MarshalByRefObject
    {
        public event TestServiceDel TestEvent;

        TestEventArgs args1 = new TestEventArgs
        {
            Data = "Hello Buddy ... How Is Life!!!!!"
        };
        public void RaiseEvent()
        {
            if (!EventLog.SourceExists("TestService"))
                EventLog.CreateEventSource("TestService", "Application");

            EventLog.WriteEntry("TestService","Before raising event ...");

            if (TestEvent != null)
                TestEvent(this, args1);

            EventLog.WriteEntry("TestService","After raising event ...");
        }
    }
</code></pre>

<p>Hosted Windows Service (windowsservice1exe)</p>

<pre><code>public partial class Service1 : ServiceBase
{
    public Service1()
    {
        InitializeComponent();
    }

    protected override void OnStart(string[] args)
    {
        System.Threading.Thread.Sleep(1000);
        ClassLibrary1.Class1 cs = new ClassLibrary1.Class1();
        cs.RaiseEvent();
     }
</code></pre>

<p>Client application (consoleapp1.exe)</p>

<pre><code>class Program : MarshalByRefObject
{
    static void Main(string[] args)
    {
        Class1 cs = new Class1();
        cs.TestEvent += Cs_TestEvent;
        Console.ReadLine();
    }

    private static void Cs_TestEvent(object sender, TestEventArgs args)
    {
        EventLog.WriteEntry("TestService",args.Data, EventLogEntryType.Information);
        Console.WriteLine(args.Data);
    }
</code></pre>

<p>As you can see, I have tried subclassing <code>MarshalByRefObject</code> for both publisher/subscriber but it's not working. I mean I can see in event log that the events are getting raised but my client application never receives the notification (or) the notification never reaches.</p>

<p>Please let me know how to achieve this. </p>

<p>Since my service and client both running in same machine, I believe I don't need to use <code>Remoting</code>. Right?</p>