private static System.Threading.Timer timer;
private const int interval = 1000 * 60 * 2;
protected void Application_Start(Object sender, EventArgs e)
{
if (timer == null)
timer = new System.Threading.Timer(new System.Threading.TimerCallback(ScheduledWorkCallback),sender, 0, interval);
}
private void ScheduledWorkCallback (object sender)
{
Directory.Delete(Server.MapPath("temp"),true);
}一有IO操作就报w3wp.exe错误,这是为什么呀,如果单独是数据库操作则没问题,IO操作写在Application_Start里也没问题,唯独写在timer的过程里就不行,我是想定时清空临时目录
private const int interval = 1000 * 60 * 2;
protected void Application_Start(Object sender, EventArgs e)
{
if (timer == null)
timer = new System.Threading.Timer(new System.Threading.TimerCallback(ScheduledWorkCallback),sender, 0, interval);
}
private void ScheduledWorkCallback (object sender)
{
Directory.Delete(Server.MapPath("temp"),true);
}一有IO操作就报w3wp.exe错误,这是为什么呀,如果单独是数据库操作则没问题,IO操作写在Application_Start里也没问题,唯独写在timer的过程里就不行,我是想定时清空临时目录
解决方案 »
- 请教一下,为什么加车后会刷新了页面
- 如何在后台取得屏幕上显示的这一长串 字符串的值,或这一长串赋值给一个变量或常量。
- 问一个设计思路。关于数据表格的更新问题。
- “不要使用日期字段,改用字符串char(19)替代”,不解
- 我没搞懂iis连接数是什么意思啊!我买的空间iis连接数为200,请问大侠放动网的论坛最大的同时在线人数是多少?能超过100人同时在线吗?(
- 求解:DataGrid的更一种显示方法。
- 为什么我在Html下编缉了页面,切换到“Design”界面下后stdio 2003就给我加上了一些乱七八糟的代码,这是什么问题,有办法搞定吗?
- 问一个获取时间的问题
- 如何在两个页面中传递参数?
- 请教各位大侠,业务流程管理软件的升级和开发
- 博客搬家的原理是什么? ~~~困扰很久的问题
- 求mm:dd的正则表达式
if(Directory.Exists(Server.MapPath("temp")))
{
Directory.Delete(Server.MapPath("temp"),true);
}
另外,里面的文件程序有在使用的马?
Directory.Delete(@"E:\abc\temp\",true);这样可以删掉
Directory.Delete(Server.MapPath("temp"),true);这样出现致命w3wp.exe错误