①首先,在WebSite里追加一个Gobal Application Class。
<%@ Application Language="C#" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
System.Timers.Timer timer = new System.Timers.Timer();
timer.AutoReset = false;
// 定时一分钟
timer.Interval = 60000;
timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
timer.Start();
}
void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
// 在这里调用你想调用的方法。
}
</script>
定时触发函数这System.Timers.Timer对象
最新推荐文章于 2021-04-06 20:09:02 发布