.net Windows Service Won't Start - Timeout

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?am1hZ2FyYW0=?=

    .net Windows Service Won't Start - Timeout

    I've written a .net Windows service in C#. It works most of the time for most
    people. It is configured to automatically start when Windows boots. Sometimes
    it fails to start on Windows XP during boot. All I know is that it is timing
    out. But no useful details appear in the event log, not even my first
    EventLog message in OnStart. How can I figure out why it isn't starting? How
    can I fix this?

    My ServiceBase constructor just sets a few properties. The first few lines
    of OnStart are...

    EventLogTraceLi stener logListener = new
    EventLogTraceLi stener("TimesUp Kidz");
    Trace.Listeners .Add(logListene r);
    try { Trace.WriteLine ("Starting") ; } catch { }

    This message does not show up in the EventLog. The log is nearly empty, so
    there is no chance of it being full and losing messages.

    These are two errors in the System EventLog:

    Timeout (30000 milliseconds) waiting for the TimesUpKidz service to
    connect.
    Service Control Manager Error Event ID 7009

    The TimesUpKidz service failed to start due to the following error:
    The service did not respond to the start or control request in a timely
    fashion.
    Service Control Manager Error Event ID 7000

    One theory I have is that maybe it is taking a very long time to load the
    ..net plumbing. I made my service dependent on:

    winmgmt (Windows Management Instrumentation )
    termservice (Terminal Services)

    The service uses Remoting.
  • Jurjen de Groot

    #2
    Re: .net Windows Service Won't Start - Timeout

    Have you tried to write your log to a regular file instead of to the
    eventlog ?
    Just to see if maybe the eventlog is the problem, maybe it's unavailable.

    Jurjen.


    "jmagaram" <jmagaram@discu ssions.microsof t.comwrote in message
    news:B6DBA61B-08D8-4C55-AACF-AB682D79C889@mi crosoft.com...
    I've written a .net Windows service in C#. It works most of the time for
    most
    people. It is configured to automatically start when Windows boots.
    Sometimes
    it fails to start on Windows XP during boot. All I know is that it is
    timing
    out. But no useful details appear in the event log, not even my first
    EventLog message in OnStart. How can I figure out why it isn't starting?
    How
    can I fix this?
    >
    My ServiceBase constructor just sets a few properties. The first few lines
    of OnStart are...
    >
    EventLogTraceLi stener logListener = new
    EventLogTraceLi stener("TimesUp Kidz");
    Trace.Listeners .Add(logListene r);
    try { Trace.WriteLine ("Starting") ; } catch { }
    >
    This message does not show up in the EventLog. The log is nearly empty, so
    there is no chance of it being full and losing messages.
    >
    These are two errors in the System EventLog:
    >
    Timeout (30000 milliseconds) waiting for the TimesUpKidz service to
    connect.
    Service Control Manager Error Event ID 7009
    >
    The TimesUpKidz service failed to start due to the following error:
    The service did not respond to the start or control request in a timely
    fashion.
    Service Control Manager Error Event ID 7000
    >
    One theory I have is that maybe it is taking a very long time to load the
    .net plumbing. I made my service dependent on:
    >
    winmgmt (Windows Management Instrumentation )
    termservice (Terminal Services)
    >
    The service uses Remoting.

    Comment

    • Paul Montgumdrop

      #3
      Re: .net Windows Service Won't Start - Timeout

      jmagaram wrote:
      I've written a .net Windows service in C#. It works most of the time for most
      people. It is configured to automatically start when Windows boots. Sometimes
      it fails to start on Windows XP during boot. All I know is that it is timing
      out. But no useful details appear in the event log, not even my first
      EventLog message in OnStart. How can I figure out why it isn't starting? How
      can I fix this?
      >
      You might want to use the example in the link for creating an Eventlog
      and writing events to it.



      One method to debug the NT service is to enable the Messenger Service on XP.

      With MSG service enabled, you can put code in the NT service like in the
      Onstart(s) or anywhere really, using the NET Send command, format a
      message, shell out to the Command Prompt and issue the Net Send with
      message and machine-name. The NET Send will pop-up a message box on the
      console screen on the machine with an OK reply button.

      So you can pop messages to yourself like Here1 Here2 Here3 to pinpoint
      where the program is going down.

      Comment

      • John Vottero

        #4
        Re: .net Windows Service Won't Start - Timeout

        "jmagaram" <jmagaram@discu ssions.microsof t.comwrote in message
        news:B6DBA61B-08D8-4C55-AACF-AB682D79C889@mi crosoft.com...
        I've written a .net Windows service in C#. It works most of the time for
        most
        people. It is configured to automatically start when Windows boots.
        Sometimes
        it fails to start on Windows XP during boot. All I know is that it is
        timing
        out. But no useful details appear in the event log, not even my first
        EventLog message in OnStart. How can I figure out why it isn't starting?
        How
        can I fix this?
        Do you digitally sign your executable? If so, you may have this problem:



        To increase the service startup timeout value, see:





        Comment

        • =?Utf-8?B?am1hZ2FyYW0=?=

          #5
          Re: .net Windows Service Won't Start - Timeout

          Assuming there is something wrong with the event log, I've tried logging to a
          file. The first line of Main is:

          File.AppendAllT ext(@"c:\log.tx t", "getting started");

          This log file does not get created during restart of the operating system.
          If I launch the service manually later, it does get logged. I'm really
          stumped here. For some reason my service can't get started and times out
          during reboot but not when I start it manually later.

          "John Vottero" wrote:
          "jmagaram" <jmagaram@discu ssions.microsof t.comwrote in message
          news:B6DBA61B-08D8-4C55-AACF-AB682D79C889@mi crosoft.com...
          I've written a .net Windows service in C#. It works most of the time for
          most
          people. It is configured to automatically start when Windows boots.
          Sometimes
          it fails to start on Windows XP during boot. All I know is that it is
          timing
          out. But no useful details appear in the event log, not even my first
          EventLog message in OnStart. How can I figure out why it isn't starting?
          How
          can I fix this?
          >
          Do you digitally sign your executable? If so, you may have this problem:
          >

          >
          To increase the service startup timeout value, see:
          >

          >
          >
          >

          Comment

          Working...