ServiceBase.OnStop not called when you use RemotingServices.Marshal on the service object

Tech-Archive recommends: Fix windows errors by optimizing your registry



I have just noticed an issue using .Net 2.0 to create a service which
uses remoting. I created a service which implemented an Interface and
discovered that the service would never stop. I have tracked this
down to the fact that I was Marshalling the service object. (My
service class implemented an interface which was to be marshalled).

I could not find anything on-line regarding this issue, and thought it
odd that I am the only one seeing this issue.

The way round the issue is to simply move the code which needed
remoting out of the service object and into another object which I
made a member of the service object. Then marshalled that object
instead of the actual service class.

Has anyone else seen this issue? If so can it be explained?

.