我已经开发了Windows服务,用于将文件从一个位置复制到另一个位置。
由于我需要在后台运行该服务,因此有必要实现计时器功能。
Service.cs
protected override void OnStart(string[] args)
{
//OnStart(new string[0]);
}
public void Start()
{
timer1 = new Timer();
this.timer1.Interval = 30000; //every 30 seconds
41 ***this.timer1.Elapsed += new System.Timers.ElapsedEventHandler(this.mysql);***
timer1.Enabled = true;
43 mysql();
}
static void mysql()
{
**File copy code included in this function.
}
错误在上面提到的第41行中触发,并且是
'mysql'的重载不匹配委托'ElapsedEventHandler'。