Home All Groups Group Topic Archive Search About

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

Author
22 Feb 2006 5:29 AM
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

Author
22 Feb 2006 6:32 AM
Adam May
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
--
Adam May
Sydney, Australia
MCSD.Net


Show quote
"Arnie" wrote:

> 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
>
>
>
Author
23 Feb 2006 10:28 PM
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

Show quote
"Adam May" <adammay.at.gmail.***@discussions.microsoft.com> wrote in message
news:0D597E46-6609-4540-8C8F-5E14AFCEE030@microsoft.com...
> 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
> --
> Adam May
> Sydney, Australia
> MCSD.Net
>
>
> "Arnie" wrote:
>
>> 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
>>
>>
>>

AddThis Social Bookmark Button