Windows Service Question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I created a windows service in OnStart and created a thread like

mainThread = new Thread(new ThreadStart(Run));
mainThread.Start();

in Run ()

while(true)
{
//do something
}

the problem that Run wont called else one time just when i click Start then
never called why?
 
Hi,

Please, explain further what your problem is, It's not very clear, a little
of code would help too

you should create the thread in the onRun method, a good advice is set
thread.isBackground = true;

of course it will be called only once, when the onstart method is called,
only if you restart the service the onStart method is executed again.

cheers,
 
Back
Top