D
Dan Schullman
Hello,
How can a Windows Service abort/stop itself after it has returned from
OnStart? That is, after a service has successfully started, it later
determines that it needs to stop. How can it make the Service Control
Manager aware that it has stopped (or wants to stop)?
In a single-service process, it appears that simply exiting the process is
sufficient to let the Service Control Manager know that the service is no
longer running. But this seems rather dirty AND doesn't handle the case of
a multiple-service process.
[I'm assuming that it is NOT legit to use ServiceController.stop() to stop
oneself.]
Thanks,
Dan S.
How can a Windows Service abort/stop itself after it has returned from
OnStart? That is, after a service has successfully started, it later
determines that it needs to stop. How can it make the Service Control
Manager aware that it has stopped (or wants to stop)?
In a single-service process, it appears that simply exiting the process is
sufficient to let the Service Control Manager know that the service is no
longer running. But this seems rather dirty AND doesn't handle the case of
a multiple-service process.
[I'm assuming that it is NOT legit to use ServiceController.stop() to stop
oneself.]
Thanks,
Dan S.