!!! Klutzo !!! said:
No, it was just my logical understanding of how a service operates.
Ah, right.
I got the app running, but it relies on a Console.Readline to "hang"
there and wait for events in a Main method.
The Main method should create an array of services it is capable of
running, and call System.ServiceProcess.ServiceBase.Run, I believe. The
service controller will then start the service. This is the confusing
part, IMO.
So, I broke up everything before the .Readline and put that in the
service Start() and everything after in the Stop().
I started to think about the service more like a windows form, that just
starts and loads "stuff" ( like a form ) and waits there, until you
"exit" it ( service.Stop() ).
It seems to work -- but honestly, I still don't exactly understand.
Well, once it's installed, the service controller loads and starts it
when you ask it to, and the OnStart method is called. You should
process this method quickly, starting other threads to do your normal
work, so that the service control manager isn't hanging around for ages
waiting to know whether or not the service has started.
When the service controller wants it to stop (either through user
action or programmatically) the OnStop method is called, and you should
at that point stop all the threads you've started, and return.