簡體   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