写了timer,调试的话在构造函数里面把Elapsed方法写成null,null就可以调试了
public PSJCService() { InitializeComponent(); GetuserInfo(); timer2 = new System.Timers.Timer(); timer2.Interval = 60000; timer2.Elapsed += new System.Timers.ElapsedEventHandler(timer2_Elapsed); timer2_Elapsed(null,null); timer = new System.Timers.Timer(); timer.Interval = 1000 * int.Parse(ConfigurationManager.AppSettings["RealTimeInterval"].ToString()); timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed); timer_Elapsed(null, null); }