定时触发函数这System.Timers.Timer对象
2010-07-15 19:37
429 查看
①首先,在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>
<%@ 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>
相关文章推荐
- C# System.Timers.Timer定时器的使用和定时自动清理内存应用
- C# --System.Timers.Timer 定时方法
- .NET System.Timers.Timer的原理和使用(开发定时执行程序)
- System.Timers.Timer 定时执行
- .NET System.Timers.Timer的原理和使用(开发定时执行程序)
- .NET System.Timers.Timer的原理和使用(开发定时执行程序)
- .NET System.Timers.Timer的原理和使用(开发定时执行程序)
- System.Timers.Timer 定时执行
- 在System.timers.timer中给定时器触发的Elapsed事件传递参数
- 使用System.Threading的Timer&Quartz.net两种方式实现定时执行任务,防止IIS释放timer对象
- 转“使用System.Timers.Timer类实现程序定时执行”
- c/s 定时操作 System.Timers.Timer
- .NET System.Timers.Timer的原理和使用(开发定时执行程序)
- System.Timers.Timer定时执行程序示例代码
- 在System.timers.timer中给定时器触发的Elapsed事件传递参数
- C# 通过System.Timers.Timer获取时间
- 在System.Timers.Timer的事件中传递参数
- System.Timers.Timer 多线程问题[转]
- System.Windows.Forms.Timer与System.Timers.Timer的区别