Need some help with a Service

  • Thread starter Thread starter Owe Armandt
  • Start date Start date
O

Owe Armandt

I have a service where I start up the worker thread from OnStart and also
stop the thread from OnStop. My problem is if the service by itself decides
to stop because of some problem it cannot handle - how wouold it stop, I
mean stop the thread itself is not a problem but the service is still
running.


Owe
 
Who said I don't use try/catch, even then it might be a decision for the
service to give up control since it could be useless to continue - missing
registry entries for instance.

Owe
 
Hi Owe,

I found that in Onstart() you can not stop the service.
May be you can create a new thread and a timer, after some time(after
Onstart method) you use this thread to
stop the service.

Hope this helps.

Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "Owe Armandt" <[email protected]>
| References: <#[email protected]>
<[email protected]>
| Subject: Re: Need some help with a Service
| Date: Tue, 26 Aug 2003 20:36:36 +0200
| Lines: 34
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2720.3000
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: mail.armandt.com 213.88.133.97
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:179592
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Who said I don't use try/catch, even then it might be a decision for the
| service to give up control since it could be useless to continue - missing
| registry entries for instance.
|
| Owe
|
|
|
| | > I don't mean to be a smart-guy, but ESPECIALLY for a service - you
should
| > have try/catch statements on EVERYTHING - so that this is impossible. A
| > service runs in the System space of memory and if it blows up could take
| > down the box - it needs to be much more stable than any user
| application...
| >
| > | > > I have a service where I start up the worker thread from OnStart and
| also
| > > stop the thread from OnStop. My problem is if the service by itself
| > decides
| > > to stop because of some problem it cannot handle - how wouold it
stop, I
| > > mean stop the thread itself is not a problem but the service is still
| > > running.
| > >
| > >
| > > Owe
| > >
| > >
| >
| >
|
|
|
 
Back
Top