Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - .net Windows Service Won't Start - Timeout

Reply
 
Old 09-26-2008   #1 (permalink)
jmagaram


 
 

.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...

EventLogTraceListener logListener = new
EventLogTraceListener("TimesUpKidz");
Trace.Listeners.Add(logListener);
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.

My System SpecsSystem Spec
Old 09-27-2008   #2 (permalink)
Jurjen de Groot


 
 

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@xxxxxx> wrote in message
news:B6DBA61B-08D8-4C55-AACF-AB682D79C889@xxxxxx
Quote:

> 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...
>
> EventLogTraceListener logListener = new
> EventLogTraceListener("TimesUpKidz");
> Trace.Listeners.Add(logListener);
> 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.
My System SpecsSystem Spec
Old 09-27-2008   #3 (permalink)
Paul Montgumdrop


 
 

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

jmagaram wrote:
Quote:

> 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.

http://support.microsoft.com/kb/307024

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.
My System SpecsSystem Spec
Old 09-29-2008   #4 (permalink)
John Vottero


 
 

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

"jmagaram" <jmagaram@xxxxxx> wrote in message
news:B6DBA61B-08D8-4C55-AACF-AB682D79C889@xxxxxx
Quote:

> 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:

http://support.microsoft.com/kb/936707

To increase the service startup timeout value, see:

http://support.microsoft.com/kb/922918



My System SpecsSystem Spec
Old 10-03-2008   #5 (permalink)
jmagaram


 
 

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.AppendAllText(@"c:\log.txt", "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:
Quote:

> "jmagaram" <jmagaram@xxxxxx> wrote in message
> news:B6DBA61B-08D8-4C55-AACF-AB682D79C889@xxxxxx
Quote:

> > 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:
>
> http://support.microsoft.com/kb/936707
>
> To increase the service startup timeout value, see:
>
> http://support.microsoft.com/kb/922918
>
>
>
My System SpecsSystem Spec
Old 11-25-2008   #6 (permalink)


Vista
 
 

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

I am encountering the same problem. My managed service application doesn't have dependency on winmgmt or termservice though. The timeout error is reported once in a while during machine reboot, and the problem just cannot be reproduced manually. My first line of code which writes a string in EventLog in OnStart() doesn't get executed so I have no idea where the hanging problem is. My service app does use .NET Remoting IPC channel but I would doubt that matters because the .NET Remoting assembly should not have been loaded since the related code had not been executed when the hang happened.

jmagaram, just wondering if you have solved the issue yet.

Thanks,
Frank
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
WLAN AutoConfig won't start | Windows Wireless Service won't start.... Network & Sharing
No timeout for stop-service cmdlet? PowerShell
Controlling service restart timeout with WMI VB Script
Windows Service Timeout in Vista Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46