What is the lifetime of an Application state?

B

Bruce W.1

I'm storing some things in the application state, like this:
Application["MyValue"] = "whatever";

In Visual Studio, when I shut down the web app then start it again the
application state information remains. If there are no browsers using
the app one would think that this would remove any application state,
but it does not.

However if I wait awhile then the application state information goes
away.

What controls the length of its life?

Thanks for your help.
 
A

Alvin Bruney [MVP]

The behavior you are seeing is somewhat skewed by the debugger. Its altered
to mimic the real world behavior as much as possible. An application is
recycled when, among other things, files are touched in the directory.
Closing visual studio does not touch the files so the application state
remains. However if you save before closing that will trigger a restart of
the app. This closely mimics real world behavior which cause an app to
restart if the config files are dirty, the number of uploaded files exceed
15, the assembly files change, idle time out etc etc.
Makes sense?
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top