Hi,
Just throw exception out of the OnStart Method. The ServiceBase will catch
it and write the exception information to the event log and mark the
service as stopped.
I hope this helps. If you have any questions, please reply to this post.
Best Regards,
Jun Su
Microsoft Support
---
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| Subject: Windows Service
| Date: Thu, 15 Aug 2002 15:11:22 +0200
|
| Building a Windows Service in VB.net...
|
| Is there a way to cancel the service start, e.g. when an exception is
caught
| in the OnStart method?
|
| Several things should happen in OnStart, such as loading data and
| instanciating objects. If any of these go wrong, I want to keep the
service
| from starting.
|
| Thnx,
| flip
|
|
|
|