Application State - volatile

  • Thread starter Tomasz Staroszczyk
  • Start date
T

Tomasz Staroszczyk

Hey everyone, I'm facing a problem of storing structures in Application
State. A structure is beeing created while the first visit of a user and
is stored in the Application State (Application["users"].Add(user) -
where Application["users"] is a List<User>). The problem is that after
20 minutes (session state interval) the structure is missing. Why?
 
J

Joern Schou-Rode

The problem is that after 20 minutes (session state interval) the
structure is missing. Why?

IIS automatically shuts down your ASP.NET applications after a period of
inactivity. While you are able to change the timeout, you will not be able
to guard yourself completely against IIS recycling the ASP.NET worker
process.

Thus, it is often the best idea to find some way to continuously serialize
the data kept in application state if it is not allowed to be dropped.
 
T

Tomasz Staroszczyk

Joern Schou-Rode pisze:
IIS automatically shuts down your ASP.NET applications after a period of
inactivity.

I understand that both of us are talking about the application state
which is claimed to be persistent, I know that IIS may wipe my objects
while memory shortage but the exact time of 20 minutest makes me curious.
Thus, it is often the best idea to find some way to continuously
serialize the data kept in application state if it is not allowed to be
dropped.

Do you mean saving the serialized state in a file? Is it really a
standard option if the data needs to be constantly updated?
 
J

Joern Schou-Rode

application state which is claimed to be persistent

It is certainly not persistent across a restart of the application. Maybe
you are refering to some other level of persistence?
Do you mean saving the serialized state in a file?

Yes, or maybe to a database, another machine or something else.

IMHO, one should never rely on 100 % uptime. Your application will be shut
down from time to time, whether you like it or not. Be it by the IIS, by a
sys adm, by yourself (eg. updating the application). Hence, if the data
stored in the application state is not allowed to be thrown away, you must
implement some strategy to continiously/periodically persist the data to
some medium that will survive the application being restarted.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,187
Latest member
RosaDemko

Latest Threads

Top