Need some help with a Service

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Owe Armandt

    Need some help with a Service

    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


  • Owe Armandt

    #2
    Re: Need some help with a Service

    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



    "Frank Drebin" <noemail@imsick ofspam.com> wrote in message
    news:rbu2b.3326 0$Vx2.14492364@ newssvr28.news. prodigy.com...[color=blue]
    > 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[/color]
    application...[color=blue]
    >
    > "Owe Armandt" <owe@armandt.se > wrote in message
    > news:%23g8tFX0a DHA.1488@TK2MSF TNGP12.phx.gbl. ..[color=green]
    > > I have a service where I start up the worker thread from OnStart and[/color][/color]
    also[color=blue][color=green]
    > > stop the thread from OnStop. My problem is if the service by itself[/color]
    > decides[color=green]
    > > 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
    > >
    > >[/color]
    >
    >[/color]


    Comment

    • Jeffrey Tan[MSFT]

      #3
      Re: Need some help with a Service


      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" <owe@armandt.se >
      | References: <#g8tFX0aDHA.14 88@TK2MSFTNGP12 .phx.gbl>
      <rbu2b.33260$Vx 2.14492364@news svr28.news.prod igy.com>
      | 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: <uOKRIDAbDHA.25 80@TK2MSFTNGP12 .phx.gbl>
      | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
      | NNTP-Posting-Host: mail.armandt.co m 213.88.133.97
      | Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP12.phx.g bl
      | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1795 92
      | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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
      |
      |
      |
      | "Frank Drebin" <noemail@imsick ofspam.com> wrote in message
      | news:rbu2b.3326 0$Vx2.14492364@ newssvr28.news. prodigy.com...
      | > 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...
      | >
      | > "Owe Armandt" <owe@armandt.se > wrote in message
      | > news:%23g8tFX0a DHA.1488@TK2MSF TNGP12.phx.gbl. ..
      | > > 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
      | > >
      | > >
      | >
      | >
      |
      |
      |

      Comment

      Working...