Yoyo Services

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

    Yoyo Services

    Hi,
    I've been trying to create a windows service that handles some system
    events, but when I try to start it stops immediately; it yoyos. I read
    somewhere that even a the service template should keep running but I built a
    copy of it and it too yoyoed. I've tried putting infinite Thread.Sleep loops
    in the Main method but they don't work. Is there something that I've
    forgotten to put in my code? I feel like I've tried everything!

    From,
    Reuben
  • Daniel O'Connell [C# MVP]

    #2
    Re: Yoyo Services


    "Reuben" <Reuben@discuss ions.microsoft. com> wrote in message
    news:FD351511-EB12-4F24-B6B8-CD7CF0881497@mi crosoft.com...[color=blue]
    > Hi,
    > I've been trying to create a windows service that handles some system
    > events, but when I try to start it stops immediately; it yoyos. I read
    > somewhere that even a the service template should keep running but I built
    > a
    > copy of it and it too yoyoed. I've tried putting infinite Thread.Sleep
    > loops
    > in the Main method but they don't work. Is there something that I've
    > forgotten to put in my code? I feel like I've tried everything!
    >[/color]

    Built a copy of what? The template or your service?

    First thing, check your event log and see if there is any mention of why the
    service is stopping. Then add logging to your service to see where its
    stopping. If you can narrow it down to where the problem is it'll be much
    easier to fix.


    Comment

    • Reuben

      #3
      Re: Yoyo Services

      Thanks. I've found out that an exception occurs in the OnStart function when
      I try to hook up my event handler to
      Microsoft.Win32 .SystemEvents.S essionEnding. Problem s, I don't understand it.
      Do you (see below).
      Thanks for your help.
      Reuben.
      =============== =============== =============== ========
      Event Type: Error
      Event Source: Symbiosis
      Event Category: None
      Event ID: 0
      Date: 30/09/2005
      Time: 5:04:31 PM
      User: N/A
      Computer: MAIN
      Description:
      The description for Event ID ( 0 ) in Source ( Symbiosis ) cannot be found.
      The local computer may not have the necessary registry information or message
      DLL files to display messages from a remote computer. You may be able to use
      the /AUXSOURCE= flag to retrieve this description; see Help and Support for
      details. The following information is part of the event: Service cannot be
      started. System.Runtime. InteropServices .ExternalExcept ion: Failed to create
      system events window thread.
      at Microsoft.Win32 .SystemEvents.E nsureSystemEven ts(Boolean requireHandle,
      Boolean throwOnRefusal)
      at
      Microsoft.Win32 .SystemEvents.a dd_SessionEndin g(SessionEnding EventHandler
      value)
      at Symbiosis.Symbi osis.OnStart(St ring[] args)
      at System.ServiceP rocess.ServiceB ase.ServiceQueu edMainCallback( Object
      state).

      Comment

      • EfeCe

        #4
        Re: Yoyo Services



        "Reuben" wrote:
        [color=blue]
        > Thanks. I've found out that an exception occurs in the OnStart function when
        > I try to hook up my event handler to
        > Microsoft.Win32 .SystemEvents.S essionEnding. Problem s, I don't understand it.
        > Do you (see below).
        > Thanks for your help.
        > Reuben.
        > =============== =============== =============== ========
        > Event Type: Error
        > Event Source: Symbiosis
        > Event Category: None
        > Event ID: 0
        > Date: 30/09/2005
        > Time: 5:04:31 PM
        > User: N/A
        > Computer: MAIN
        > Description:
        > The description for Event ID ( 0 ) in Source ( Symbiosis ) cannot be found.
        > The local computer may not have the necessary registry information or message
        > DLL files to display messages from a remote computer. You may be able to use
        > the /AUXSOURCE= flag to retrieve this description; see Help and Support for
        > details. The following information is part of the event: Service cannot be
        > started. System.Runtime. InteropServices .ExternalExcept ion: Failed to create
        > system events window thread.
        > at Microsoft.Win32 .SystemEvents.E nsureSystemEven ts(Boolean requireHandle,
        > Boolean throwOnRefusal)
        > at
        > Microsoft.Win32 .SystemEvents.a dd_SessionEndin g(SessionEnding EventHandler
        > value)
        > at Symbiosis.Symbi osis.OnStart(St ring[] args)
        > at System.ServiceP rocess.ServiceB ase.ServiceQueu edMainCallback( Object
        > state).
        >[/color]

        Reuben,
        Try running your service under a Username/Password account and not the
        System account. Start from there.
        Francisco

        Comment

        Working...