I'm writing a windows service in .net 2.0.
What should I do within the OnStart()
method if for some reason I don't want my service to start? Can I simply call the Stop()
method of the base class (ServiceBase
)? I've tried that and am getting some funny memory access exceptions. Is it required to start a separate thread to call the Stop()
method?
Why do you want to do that? If there's an error, log it in event log and throw an exception. Your service won't be started and the user will be informed that something bad happened.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With