简体   繁体   English

线程睡眠功能无响应

[英]Thread sleep function Not responding

In my ASP.NET web page ( C# ) I want to execute one function every half an hour so i am using the following code 在我的ASP.NET网页( C# )中,我想每半小时执行一个功能,因此我正在使用以下代码

while (true)
{
    Thread.Sleep(1800000);
    checkstatus();
}        

I want to know whether this thread is sleeping half an hour or not. 我想知道这个线程是否在睡眠半个小时。 Or Is there any expiry time for Thread.Sleep() . Thread.Sleep()是否有任何到期时间?

If i give 60000 instead of 1800000 the code is working for me. 如果我给出60000而不是1800000,则代码对我有效。 Can any one tell me why it is not responding for Thread.Sleep(1800000); 谁能告诉我为什么它对Thread.Sleep(1800000)没有响应? means it is not executing the checkstatus() ? 表示它没有执行checkstatus()吗?

IIS is probably shutting down your worker process... The default value is set at 20 minutes. IIS可能正在关闭您的工作进程...默认值设置为20分钟。

IIS 7中应用程序池的高级设置

Set an object in cache to expire every 30 mins. 将缓存中的对象设置为每30分钟过期一次。 Check if this cache object exists, if not, 30 mins expire so do your logic, and, in finally set cache object again. 检查此高速缓存对象是否存在,如果不存在,则30分钟到期,逻辑也是如此,最后重新设置高速缓存对象。 Sorry for wording. 对不起,措辞。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM