Re: .Net (C#) Service Fails To Start
- From: "Jared Parsons [MSFT]" <jaredpar@xxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 11 May 2005 10:48:52 -0700
One technique you could try if all else fails is to insert a try/catch block
around all of the code in your OnStart() method and show any errors in a
message box. Note this will require your service to have the "Interact With
Desktop" permission. Alternately, you could write the message to a known
file on disk.
--
Jared Parsons [MSFT]
jaredpar@xxxxxxxxxxxxxxxxxxxx
http://blogs.msdn.com/jaredpar
"This posting is provided "AS IS" with no warranties, and confers no rights"
"Ken Allen" <kendrhyd@xxxxxxxxxxxx> wrote in message
news:eV3KMJjVFHA.4056@xxxxxxxxxxxxxxxxxxxxxxx
>I have a number of services developed in C# (.Net), and they have been
>working fine for the most part. Recently someone reported that ipon
>occassion (originally rarely, but more frequently on some systems of late),
>there is an entry in the Event Log immediately after a boot indicating that
>the service failed to start after 30,000 milliseconds. Usually it starts
>fine when attempting manually after the boot.
>
> I instrumented the code to write entries to the Event Log during its
> main() execution as well as during the OnStart() execution -- but when it
> fails, there are no entries in the Event Log from the service code!
>
> Attempting to launch the service as a console application always seems to
> succeed. Interestingly, launching as a console application is about 10
> times faster than starting the service! In no case that the service loaded
> properly did the time pass the 500 milliseond duration!
>
> I checked and there are no dependencies marked for the service. Is it
> possible that .Net is not available at that time and the service cannot
> execute?
>
> How can I define any dependencies at compile time? The ServiceInstaller
> permits me to define a list of services to depend on, but there does not
> seem to be any dependency on other objects. Nor does there appear to be
> any .Net service on which I could wait.
>
> Does anyone have any ideas on why my service may be failing to load, but
> only at boot time?
>
> Where does the /LogToConsole=false switch setting come from on my
> installed services? How do I change this to true, and what effect would
> that have on my service?
>
> -ken
.
- Follow-Ups:
- Re: .Net (C#) Service Fails To Start
- From: Ken Allen
- Re: .Net (C#) Service Fails To Start
- References:
- .Net (C#) Service Fails To Start
- From: Ken Allen
- .Net (C#) Service Fails To Start
- Prev by Date: Re: Reporting Tool
- Next by Date: Re: .Net (C#) Service Fails To Start
- Previous by thread: .Net (C#) Service Fails To Start
- Next by thread: Re: .Net (C#) Service Fails To Start
- Index(es):
Relevant Pages
|
Loading