Timer tick event is not called in windows service

后端 未结 5 1368
梦如初夏
梦如初夏 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:16

    Are you sure it's the timer that's the issue? It's extremely unusual for a windows service to access the sound system, (How would you turn it off?) it may be blocked or it may require "interaction with desktop" enabled.

    Having said that, TomTom is right, Forms Timers are about being able to Marshal to the UI thread, which you don't have, rather using a Threading timer.

提交回复
热议问题