.NET based services not starting reliably: ServiceController.Start() method

A

Arnie

We're using the ServiceController class provided by the .NET Framework,
programming in C#. We are using the Start() method to start a service from
another service. This works fine most of the time, but occasionally after a
system startup (where the service doing the starting of the other is
automatically started by Windows XP) the ServiceController's Start() method
fails to start the other service. It is probably throwing an
InvalidOperationException in these cases (we know it is in some cases). Is
there any way to tell why Windows cannot start the service, and are there
known problems with the reliability of the Start() method? It works most of
the time, but occasionally after unsealing the XP OS, or after a restart,
this fails. We're trying retries of calls to the Start() method, but after
3 retries it still fails inexplicably.



We need to find out if:



1.. this is a known problem
2.. how long does it wait, and is this wait time adequate?
3.. can this happen if one of the services upon which the service being
started depends takes too long to start? We are quite sure the actual
service being started takes almost no time to execute its two lines that
consist of starting a worker thread in its OnStart() method.
4.. is there some reason this would only occur after an unseal or system
restart (that's the only time we see it)?
5.. there are any known fixes or workarounds to this problem
 
G

Guest

Arnie,

Most of the problems that I've come across with the Start() method have been
of my own doing.

Are you able to post the code that you've got in your Start() so that we can
help further?

Adam
 
A

Arnie

Let me check up on getting the source.

In the mean time, all we are doing is having a service started automatically
and it in turn calls Start() on a second service. It holds up pretty well
but it does fail periodically after power cycles.

-jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top