Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET HttpContext.Current.Application Lifespan

Tags:

asp.net

I have a web service that is tracking a user across operation calls. I'm storing my users' information in the HttpContext.Current.Application variable, which is a HttpApplicationState. I've noticed that sometimes, my key is there, sometimes it is not. Because of this, I assume that the duration of my application state is expiring.

Is there a way to configure this? If so, how?

THank you!

like image 535
Villager Avatar asked Dec 03 '25 06:12

Villager


2 Answers

After x minutes of idle time, IIS will terminate the worker processes. I assume that HttpApplicationState will then be lost.

You can disable idle timeout, see How to prevent/extend idleTimeout in IIS 7?

like image 138
Richard Schneider Avatar answered Dec 04 '25 20:12

Richard Schneider


The application will be unloaded through the iss after a idle time. You can set this idletime to 0 in the properties of the application pool. With the setting 0 the iis will never unload your app.

like image 41
sra Avatar answered Dec 04 '25 20:12

sra



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!