Dave,
| ServiceBase.Stop() isn't new in .NET 2.0.
Did you mean it *is* new in .NET 2.0?
As the page I gave suggests its new to .NET 2.0, its not available in .NET
1.x.
--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley -
http://www.tsbradley.net
| ServiceBase.Stop() isn't new in .NET 2.0.
|
| I'm going to try Environment.Exit. That's what I was looking for, I just
| didn't know what it was called.
|
|
| message | > Rune,
| > | If you need to stop before OnStart is done, start an
| > | async. thread, ie. using a Timer, call ServiceController.Stop from
| > there.
| > If you need to stop before OnStart is done, simply call
ServiceBase.Stop.
| >
| >
http://msdn2.microsoft.com/en-us/library/system.serviceprocess.servicebase.stop.aspx
| >
| > If you are running .NET 1.x, I would first recommend upgrading, second
| > consider using the Environment.Exit hack, third consider using the async
| > thread hack
| >
| > --
| > Hope this helps
| > Jay B. Harlow [MVP - Outlook]
| > .NET Application Architect, Enthusiast, & Evangelist
| > T.S. Bradley -
http://www.tsbradley.net
| >
| >
| > | > | | > |
| > | > I have written a multi-threaded Windows Service in .NET. During
| > | > startup of the service I need to check for some condition and stop
the
| > | > service if the condition is not met. What is the best way to do
that?
| > | > Due to time constraints I have to check the condition in a
separate
| > | > thread created in the OnStart event so that the OnStart event can
| > | > complete within the 30 second window that Windows requires for
service
| > | > start.
| > | >
| > | > I assume the only way for a service to stop itself is to use the
| > | > service controller class?
| > |
| > | That is correct, you use ServiceController.Stop. But you cannot do
this
| > in
| > | the OnStart-event. If you need to stop before OnStart is done, start
an
| > | async. thread, ie. using a Timer, call ServiceController.Stop from
| > there.
| > |
| > | --
| > | Rune Huseby
| >
| >
|
|