By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,179 Members | 1,175 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,179 IT Pros & Developers. It's quick & easy.

.net Windows Service Won't Start - Timeout

P: n/a
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.
Sep 26 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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" <jm******@discussions.microsoft.comwrote in message
news:B6**********************************@microsof t.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...

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.
Sep 27 '08 #2

P: n/a
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.

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.
Sep 27 '08 #3

P: n/a
"jmagaram" <jm******@discussions.microsoft.comwrote in message
news:B6**********************************@microsof t.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:

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

To increase the service startup timeout value, see:

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

Sep 29 '08 #4

P: n/a
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:
"jmagaram" <jm******@discussions.microsoft.comwrote in message
news:B6**********************************@microsof t.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:

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

To increase the service startup timeout value, see:

http://support.microsoft.com/kb/922918
Oct 3 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.