If I understand you correctly, you are still firing off events registered by
clients after the client has exited? Do your clients unregister from the
events prior to shutting down? Have them do this prior to exiting and see if
that makes a difference.
[quoted text, click to view] "Dan Alexander" wrote:
> Hi,
>
> I've got a problem with Remoting and I was wondering if you kind folks could
> shed some light on it. Here's the situation:-
>
> I have a windows service that gathers information from a source once a
> minute; After it has gathered the information I need it to inform any client
> applications that happen to be listening that the information has been
> fetched.
>
> My solution was to create a remotable object that inherits from
> MarshallByRefObject and has a delegate and an event etc. The service then
> hosts this object. It then creates an instance using Activator.GetObject so
> that it can raise events. I tried just creating an instance of the object but
> no clients were recieving the events! In essence the windows service hosts
> the object and then creates a client for itself.
>
> This all works fine and I can connect a client to it and the client will
> recieve events.
>
> The problem is that when I shut down the client (a simple windows app) the
> windows service keeps throwing socket errors
> (System.Net.Sockets.SocketException) saying that the host actively refused
> connection. Now, I'm guessing its because the instance within the service is
> dead because the client application has killed it off somehow.
>
> Basically what I need to know is how can I get a Windows Service to inform
> clients that things are happening?
>
> If you want a copy of my code then let me know and I'll zip it up and send
> it on. Thanks for any replies,
>
I've managed to figure it out and yes, it was to do with registering and
unregistering handlers (good ole AddHandler and RemoveHandler).
[quoted text, click to view] "William Sullivan" wrote:
> If I understand you correctly, you are still firing off events registered by
> clients after the client has exited? Do your clients unregister from the
> events prior to shutting down? Have them do this prior to exiting and see if
> that makes a difference.
>
> "Dan Alexander" wrote:
>
> > Hi,
> >
> > I've got a problem with Remoting and I was wondering if you kind folks could
> > shed some light on it. Here's the situation:-
> >
> > I have a windows service that gathers information from a source once a
> > minute; After it has gathered the information I need it to inform any client
> > applications that happen to be listening that the information has been
> > fetched.
> >
> > My solution was to create a remotable object that inherits from
> > MarshallByRefObject and has a delegate and an event etc. The service then
> > hosts this object. It then creates an instance using Activator.GetObject so
> > that it can raise events. I tried just creating an instance of the object but
> > no clients were recieving the events! In essence the windows service hosts
> > the object and then creates a client for itself.
> >
> > This all works fine and I can connect a client to it and the client will
> > recieve events.
> >
> > The problem is that when I shut down the client (a simple windows app) the
> > windows service keeps throwing socket errors
> > (System.Net.Sockets.SocketException) saying that the host actively refused
> > connection. Now, I'm guessing its because the instance within the service is
> > dead because the client application has killed it off somehow.
> >
> > Basically what I need to know is how can I get a Windows Service to inform
> > clients that things are happening?
> >
> > If you want a copy of my code then let me know and I'll zip it up and send
> > it on. Thanks for any replies,
> >
Hey Dan,
I'm trying to do something similiar but have hit a roadblock. Can you email me the source code.
Don't see what you're looking for? Try a search.