繁体   English   中英

Windows 2003服务和计时器问题导致无法调用Tick?

[英]Windows 2003 Service and Timer issues causing Tick not to be called?

Win2k3上的服务中的计时器存在一些问题...基本上,创建每隔X分钟/秒检查一次特定进程以及该进程是否正在运行的服务。 我认为最简单的方法是通过计时器。

设法成功安装了该服务,并且似乎正在报告它正在启动/停止。 我已使用Eventlog.WriteEntry写入事件日志,并观察到它正在到达启动功能,但没有到达计时器刻度。

            EventLog.WriteEntry("SETTINGS SET");
            // Set our timer's interval to the value set in the settings.xml file.
            tmrCheck.Interval = Int32.Parse(_settingChkInterval) * 1000;
            // Enable our timer and away we go, checking away!
            tmrCheck.Enabled = true;
            // Set our Tick event to our Tick void
            tmrCheck.Tick += new EventHandler(tmrCheck_Tick_1);

嗯,您不能在服务中使用Winform计时器。

您需要使用System.Timers.TimerSystem.Threading.Timer

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM