System.Timers.Timer timer1_Elapsed not firing! Help!

前端 未结 4 674
陌清茗
陌清茗 2021-01-22 22:14

I am creating another windows service and my timer is not ticking and I have no idea why! I am using system.timers.timer as I have in previous services and it doesn\'t work. I

4条回答
  •  旧时难觅i
    2021-01-22 22:56

    System.Timers.Timer.Start() has a same function as System.Timers.Timer.Enabled=true; System.Timers.Timer.Stop() has a same function as System.Timers.Timer.Enabled=false;

    Those 2 methods internally sets Enabled property to true or false which starts or stops the timer.

    Check if you have permission to write to eventlog. You can also check for errors in eventlog.

    System.Timers.Timer is not thread safe. Make sure you use it properly.

提交回复
热议问题