kfu*_*ang 13
您可以使用静态Timer并从Global.asax中的Application_Start()方法启动它.
在Global.asax中,添加以下字段:
static Timer _timer = null;
Run Code Online (Sandbox Code Playgroud)
然后你可以使你的Application_Start()像:
void Application_Start(object sender, EventArgs e)
{
if (_timer == null)
{
_timer = new Timer();
_timer.Interval = 1000; // some interval
_timer.Elapsed += new ElapsedEventHandler(SomeStaticMethod);
_timer.Start();
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9054 次 |
| 最近记录: |