I know about ServiceBase.Stop(), but what is best practice ?
What is if i want to stop with error (Environment.Exit() or throw an
exception) ?
Both ways, the service stops immediately without any cleanups (no go i would
say).
I know about ServiceBase.Stop(), but what is best practice ?
What is if i want to stop with error (Environment.Exit() or throw an
exception) ?
Both ways, the service stops immediately without any cleanups (no go i
would say).
So write a cleanup method whose final line calls Stop(). Stopping with an
error code is a bad idea in my opinion, like some throwback to DOS. I
recommend writing an error to the event log instead of an returning error
code.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.