benjamin54
benjamin54

Reputation: 1300

ASP.NET Application object timeout issue

I'm getting some data from the web service to my generic handler after uniform interval of 1 minute. I've a List type collection that holds each data received in the handler. with context.Application["mykey"] (which contains list).

In my web site, I gt all the data in this application object fine. But when day changes, i.e after 12 am, all the data is lost.

Is there a way, can I persist the data which was added to the list on previous day? Thanks.

Upvotes: 0

Views: 400

Answers (1)

vtortola
vtortola

Reputation: 35905

IIS can shut down your application domain if it is not in use for 20 minutes default at any time, and it will start again with the same request. This process is called "recycling". Despite you can configure how long IIS must wait, it is good not to alter this behaviour.

What you should do is save that information in your App_Data folder, using XML or JSON. And in your Application_Start global event, take a look for that file and if it exist, deserialize it and put it in place.

You can use the cache for this if you set up a persistent cache provider.

Cheers.

Upvotes: 1

Related Questions