asp.net 通过Global.asax 定时执行web应用中的的程序
protected void Application_Start(object sender, EventArgs e)
{
System.Timers.Timer t = new System.Timers.Timer(3000000); //差不多办小时一次,比如10秒,就写10000
t.Enabled = true;
t.Elapsed += new System.Timers.ElapsedEventHandler(Interval);
t.Start();
}
void Interval(object sender, System.Timers.ElapsedEventArgs e)
{
//添加自己的代码
OA.BLL.Duty bll = new OA.BLL.Duty();
bll.SetDuty();
}