Windows service timeout

C

Cubaman

Hello everybody. I'm currently developing a windows service. In OnStart
a launch two threads that carry on some work while the service is
running. My problem comes from the fact that once the service is
installed, it just time out at system startup and don't start. But i'm
able to start it manually once i'm logged in. I read in a page
something about signed assemblyes, saying that clr have to verify the
executable at startup, causing the delay. I just unsigned the assembly
and still face the same problem. I also notice that some compilation of
the solution start at system starup, and othes does not, with out
aparent reason, because there is no code change. Any sugestion? Thanks
in advance.
 
G

Guest

Cubaman,
You don't show any sample code for what is happening in the OnStart method.
OnStart basically gives you a 30 second SCM Timeout.
So if you are kicking off 2 threads, they should be background threads and
the Start methods must return within the startup timeout period.
Peter
 
C

Cubaman

Hello Peter, and thanks for your answer. Here is the code i'm executing
in OnStart method:

/// <summary>
/// Method launched on service start.
/// </summary>
/// <param name="args">none</param>
protected override void OnStart(string[] args) {
ThreadPool.QueueUserWorkItem(new WaitCallback(JobWs),
null);
ThreadPool.QueueUserWorkItem(new
WaitCallback(JobManteinance), null);
//// Write info to eventlog, so controler detects the
service start.
eventLog.WriteEntry("Service started",
EventLogEntryType.Information);
}

JobWs and JobManteinance are two functions that do all the work.
What do you mean by background thread? A thread with a low priority?
Thank you, best regards.

Oscar Acosta
 

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