int count = 0;
    System.Timers.Timer timer = null;
    void Application_Start(object sender, EventArgs e)
    {
        // 在应用程序启动时运行的代码
        timer = new System.Timers.Timer(3600000);
        timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
        timer.AutoReset = true;
        Application.Lock();
        Application["timer"] = DateTime.Now;
        Application.UnLock();
        timer.Enabled = true;
    }    void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
    {   
        Application.Lock();
        DateTime dtNow = Convert.ToDateTime(Application["timer"]);
        dtNow.AddSeconds(3600);        if (dtNow != null) 
        {
            if (DateTime.TryParse(dtNow.ToString(),out dtNow)) 
            {
                int hoursNow = dtNow.Hour;
                
                if (hoursNow.Equals(21)&&count.Equals(0)) 
                {
                    count++;
                    //这里可以写你需要执行的任务,比如说,清理数据库的无效数据或增加每个用户的积分等等
                    
                }
                else if (hoursNow.Equals(1)) 
                {
                    count = 0;
                }
            }
        }
        Application.UnLock();
    }