user3587180
user3587180

Reputation: 1397

How to finish code execution after stopping windows service?

I'm using a simple windows service app. Some of the code takes around a minute to finish executing. If I want to rollout news changes to production, how do I ensure that even after I stopped the service, the service finished what ever it's executing?

Upvotes: 0

Views: 246

Answers (1)

Terry Carmen
Terry Carmen

Reputation: 3886

Your new service would need to check to make sure the old process isn't running.

How can I verify if a Windows Service is running

A better way would be to fix your service so it can be shutdown in a reasonable length of time. A minute is much too long to stop a service.

Whatever it's doing needs to be able to cleanly stop or roll back on request.

Upvotes: 1

Related Questions