Timer tick event is not called in windows service

后端 未结 5 1379
梦如初夏
梦如初夏 2021-01-06 13:29

I have a window service which plays a sound file at a specified time, so to do that I have taken Timer but it\'s Tick event is never fired, same is working in WinForm applic

5条回答
  •  我在风中等你
    2021-01-06 14:03

    Try to use the System.Timers.Timer instead.

    this.alarmTimer = new System.Timers.Timer();
    

    The System.Windows.Forms.Timer - as it names implies - works in Forms applications, but not in something like a NT Service.

提交回复
热议问题