简体   繁体   中英

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

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() .

If i give 60000 instead of 1800000 the code is working for me. Can any one tell me why it is not responding for Thread.Sleep(1800000); means it is not executing the checkstatus() ?

IIS is probably shutting down your worker process... The default value is set at 20 minutes.

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

Set an object in cache to expire every 30 mins. Check if this cache object exists, if not, 30 mins expire so do your logic, and, in finally set cache object again. Sorry for wording.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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