Raghuveera
Raghuveera

Reputation: 320

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

Upvotes: 1

Views: 507

Answers (2)

Hassan
Hassan

Reputation: 1

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.

Upvotes: 0

Chris Hammond
Chris Hammond

Reputation: 2186

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

Advance Settings of App Pool in IIS 7

Upvotes: 4

Related Questions