Lee,
Which was the point of my second suggestion.
Leave the Service running, but have it go to a "sleep mode". By "sleep mode"
I mean if its waiting for an Async event, don't wait for the event. If it
has a second thread, kill the second thread. If its using a Timer, stop the
Timer. If its using Remoting, stop Remoting. If its using TCPListener, stop
listening. What ever it is using to decide it has work to do, simple don't
do that! Let all threads (explicit or ThreadPool) exit without a request to
come back for more. Yes the service itself would still be "running" however
it would not be doing anything, it would effectively be waiting for commands
from the SCM.
Because as you suggested, I'm really not sure what will happen if you used
End, nor do I see a "polite" way of tell the SCM, hey I had a problem please
terminate me.
This would effectively mean that a person would need to stop & start the
service again (or do a restart), which can be a good thing, as the person
could diagnose any problems!
Or in the simplest sense: set a global variable to true, in all of your
routines if the global variable is true, exit routine!
Hope this helps
Jay