I have a service that performs several tasks, one after the other, on a specific date and time. These tasks involve opening files, launching other processes, interacting with databases, etc. I'm wondering exactly what happens when a stop command is issued via the SCM or the system is powered down.
I have a timer in the service that periodically checks if it's time to do some work. If so, it executes all the task in synchronous fashion. If the service is stopped while waiting for an external process to complete, are OnStop or OnShutdown immediately fired regardless of the service code that's currently executing? I have overidden both handlers, but there's not much code in either at the moment. Is there any way to ignore or countermand the stop request so the service can at least finish its current task?
Much obliged,
Chris
I have a timer in the service that periodically checks if it's time to do some work. If so, it executes all the task in synchronous fashion. If the service is stopped while waiting for an external process to complete, are OnStop or OnShutdown immediately fired regardless of the service code that's currently executing? I have overidden both handlers, but there's not much code in either at the moment. Is there any way to ignore or countermand the stop request so the service can at least finish its current task?
Much obliged,
Chris