HighTechTalks DotNet Forums  

How to cancel service startup during OnStart?

Dotnet Framework (Component Services) microsoft.public.dotnet.framework.component_services


Discuss How to cancel service startup during OnStart? in the Dotnet Framework (Component Services) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
SharpCoderMP
 
Posts: n/a

Default How to cancel service startup during OnStart? - 10-30-2006 , 10:39 AM






hi,

as in subject - how can i do that?
when my service starts up it performs some tests within OnStart method.
i would like it to refuse to start if some of these tests fail. there is
simply no point in running my service if certain criteria is not met. in
that case i would like to log test results and just stop. calling
this.Stop() inside OnStart method does not sound like a good idea :/

Reply With Quote
  #2  
Old   
Andy
 
Posts: n/a

Default Re: How to cancel service startup during OnStart? - 10-30-2006 , 12:46 PM






Throwing an exception should work.

SharpCoderMP wrote:
Quote:
hi,

as in subject - how can i do that?
when my service starts up it performs some tests within OnStart method.
i would like it to refuse to start if some of these tests fail. there is
simply no point in running my service if certain criteria is not met. in
that case i would like to log test results and just stop. calling
this.Stop() inside OnStart method does not sound like a good idea :/


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.