Link to home
Start Free TrialLog in
Avatar of tinman1412
tinman1412

asked on

Windows Service Won't Start

Hello,

I have a windows service that works fine. All it does it write something to a text file. I use "InstallUtil" to register the service and runs it manually
in the Service Controller by right-clicking on it and select "Start". The problem I have is that I have a service that takes several minutes b/c
it's retrieving a large amount of data from the database. It takes around 2 minutes when testing from my web page. When I manually start the service,
it would timeout around 90 seconds. Is there a registry setting or something where I can increase the time for a service to start. Please advise

Thanks
Avatar of jjacksn
jjacksn

what do you mean by timeout?  I am unaware that the service manager will timeout services.  
Avatar of tinman1412

ASKER

Yes it does. Just write something that will take over 2 minutes and make it a window service. You will notice that your service will try to start but it doesn't do anything, and you get a weird prompt. I don't remember what that prompt is at the moment
I dont remember whether its 30 or 90 seconds but there is a time limit within which the onStart method has to finish its execution, otherwise the system thinks that the service is malfunctioning and you will get an error message.

Because of this its not advisable to have any long running task in the onStart method. But if this cant be avoided then as in your case you should spwan of a new thread in the onstart method and have that thread to the file writting job
New Thread?. What do you mean by this?. Can you provide code samples?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of checoo
checoo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial