开发者

Does C# windows service takes time to start around 60-65 sec? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 6 years ago.

Improve this question

I designed a windows service in C#,开发者_如何学Go and it takes time to start (60-70 sec). I was wondering does it generally take that long to start? It is my code which is taking that much time?

I have two threads which runs every 6 seconds and 1 minute.

And if it takes that much time, can somebody tell me why it takes that much time. Not in detail just an overview.


If your service does alot of work during startup (service.OnStart), it will take a long time to start.

Defer the work to another thread if you want the service to startup immediatly.

This assumes that normal service startup is pretty much immediate.


Like Oded said,

     protected override void OnStart(string [] args)
  {
System.Threading.Thread workerThread =new System.Threading.Thread(longprocess());
workerThread.start();
  }

private void longprocess()
{
///long stuff
}

Although this will make your service to startup quickly it will not gurantee that longprocess() will be done quickly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜