trufun101

trufun101

  • NA
  • 19
  • 0

Trouble with Timers in a Windows Service

Apr 19 2004 4:30 PM
Has anyone else ran into any problems with Timer events not firing consistantly in a Windows Service? For example, I have a System.Timers.Timer that elapses every 2 seconds or so. On timer tick, I stop the timer...process the pending jobs...and restart the timer. myTimer_Elapsed() { myTimer.Stop(); //get jobs and process myTimer.Start(); } This will work for some period of time...say 3 or 4 hours...but eventually it stops working, and I have to restart the service. I've been told to add the following line after "myTimer.Stop();" myTimer.AutoReset = true; Does anyone know of another solution? I want to ensure that this AutoReset is a valid solution. Thanks, -Chris B.

Answers (2)