asp.net 使用timer 定时执行任务

protected void Application_Start(Object sender, EventArgs e)
  {
   System.Timers.Timer myTimer=new System.Timers.Timer(10000); 
   myTimer.Elapsed+=new System.Timers.ElapsedEventHandler(examlpe);
   myTimer.AutoReset = true ; 
   Application.Lock();
   Application["a"]= DateTime.Now.ToString();
   Application.UnLock();
   myTimer.Enabled = true ;
  }
  private void examlpe(object sender,  ElapsedEventArgs e)
  { 
   Application.Lock();
   Application["a"]= DateTime.Now.ToString();
   Application.UnLock();
  }
原文地址:https://www.cnblogs.com/cuihongyu3503319/p/1250735.html