How to exit service at OnStart() stage

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a windows service. The OnStart() method initializes the service and
gets it ready for other tasks. In some circumstances, the initialization in
OnStart() could fail. And sometimes the failure is so catastrophic that it
makes no sense to keep the service running. In this case, how can I exit the
service and pass the service status to SCM?

Thanks in advance.
 
Back
Top