Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to recycle IIS application pools without losing user sessions?

Tags:

asp.net

iis

We're currently deploying code to live pretty reguarly at the moment, but the down side is destroying user session data.

Is there a way of being able to recycle IIS without loosing session data, or is persisiting session state in SQL server or alike the only way?

like image 693
gb2d Avatar asked Nov 25 '10 14:11

gb2d


People also ask

Does recycling app pool disconnect users?

The vast majority of IIS application pool recycles do not cause any interruption (disconnection) for the end users.

What happens when you recycle an application pool in IIS?

When you recycle an application pool, IIS will create a new process (keeping the old one) to serve requests. Then it tries to move all requests on the new process. After a timeout the old process will be killed automatically.

Does restarting IIS recycle application pools?

Does IISRESET recycle the application pools? The correct answer is no. Instead, IISRESET causes the shutdown of all active IIS worker processes, kills them if they do not stop in time.


1 Answers

In-memory session state is stored in the memory of the IIS worker process. When you restart the application pool you are effectively stopping and restarting the worker process, so whatever state is held by the worker process, including all session objects, is lost. So, yes, you need store session data outside the IIS worker process, such as in SQL, in order to not "destroy" users' session data.

like image 172
Klaus Byskov Pedersen Avatar answered Nov 08 '22 08:11

Klaus Byskov Pedersen