Does Windows C # run for about 60-65 seconds?

Guys, I developed a Windows service in C # and you need time to start (60-70 seconds). I was wondering if this usually takes so long, or is this my code that takes a lot of time. I have two threads that run every 6 seconds and 1 minute.

And if it takes a long time, can someone tell me why it takes a long time. Not in details just a review.

+3
source share
2 answers

If your service runs a lot during startup ( service.OnStart), it will take a long time.

Postpone work to another thread if you want to start the service immediately.

, .

+7

,

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

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

, , longprocess() .

+2

Source: https://habr.com/ru/post/1728647/


All Articles