windows服务中timer1_Tick不执行

做了个windows服务 但是事件 timer1_Tick却不执行

原因 windows服务里不能使用System.Windows.Forms的Timer控件.Windows.Forms 计时器组件用于 Windows.Forms 环境.

WindowsForms 计时器组件不用于服务器环境,所以可以使用System.Timer下的控件

System.Timers.Timer tss = new System.Timers.Timer();
tss.Elapsed += new ElapsedEventHandler(tss_Elapsed);

 

 

posted @ 2012-08-17 17:32  xfyn  阅读(827)  评论(0编辑  收藏  举报