global.asax中写入定时器发布到服务器不启动
voidApplication_Start(objectsender,EventArgse){//在应用程序启动时运行的代码System.Threading.Thread...
void Application_Start(object sender, EventArgs e)
{
//在应用程序启动时运行的代码
System.Threading.Thread my_timer1 = new System.Threading.Thread(write_1);
my_timer1.Start();
System.Threading.Thread my_timer2 = new System.Threading.Thread(write_2);
my_timer2.Start();
}
//月定时
System.Timers.Timer mytimer1 = new System.Timers.Timer(600000);
private void write_1()
{
mytimer1.Enabled = true;
mytimer1.Elapsed += new System.Timers.ElapsedEventHandler(mytimer_month);
mytimer1.AutoReset = true;
GC.KeepAlive(mytimer1);
}
//日定时
System.Timers.Timer my_timer2 = new System.Timers.Timer(600000);
private void write_2()
{
my_timer2.Enabled = true;
my_timer2.Elapsed += new System.Timers.ElapsedEventHandler(mytimer_day);
my_timer2.AutoReset = true;
GC.KeepAlive(my_timer2);
} 展开
{
//在应用程序启动时运行的代码
System.Threading.Thread my_timer1 = new System.Threading.Thread(write_1);
my_timer1.Start();
System.Threading.Thread my_timer2 = new System.Threading.Thread(write_2);
my_timer2.Start();
}
//月定时
System.Timers.Timer mytimer1 = new System.Timers.Timer(600000);
private void write_1()
{
mytimer1.Enabled = true;
mytimer1.Elapsed += new System.Timers.ElapsedEventHandler(mytimer_month);
mytimer1.AutoReset = true;
GC.KeepAlive(mytimer1);
}
//日定时
System.Timers.Timer my_timer2 = new System.Timers.Timer(600000);
private void write_2()
{
my_timer2.Enabled = true;
my_timer2.Elapsed += new System.Timers.ElapsedEventHandler(mytimer_day);
my_timer2.AutoReset = true;
GC.KeepAlive(my_timer2);
} 展开
1个回答
2013-03-27
展开全部
你应该用Thread里的定时器。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
浙江启扬智能科技有限公司
2023-06-12 广告
2023-06-12 广告
不一定要用Linux系统的。例如ARM9系列可以用WinCE系统。但是目前不建议用windows操作系统进行开发。因为目前支持WinCE的处理器平台偏低端;而且WinCE需要版权费用,在稳定性上,低于Linux系统。像启扬他们做了一些ARM...
点击进入详情页
本回答由浙江启扬智能科技有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询