I have a .NET Windows service that runs multiple threads. A developer added some new threads to it but forgot to add code to exit the threads before the service stops. When I stop the service, it appears to stop normally, but the exe process continues running for several seconds after the service has stopped. What is happening during this time and what happens to the threads?
Share
If you don’t terminate the threads, but handle the ServiceStop message correctly, the other threads continue to run for ~20 secs, then the OS kills off the service process, killing the threads along the way.
Doesn’t seem to do any harm, in general.