views:

104

answers:

3

How do you work-around the fact that sessions are dropped every time you deploy certain code files to an ASP.NET website? Sometimes we need to deploy a crucial fix in the middle of the day but don't want to boot off all our users for it.

+3  A: 

By default Sessions are stored InProc. You should choose an out-of-process option.

Maybe just a StateServer is enough in your scenario

Rubens Farias
Using StateServer would fix the problem. Be aware thought that everything you want to put in session will need to be serializable when using any out of process session storage.
TonyB
+1  A: 

One way would be to have a load-balanced server set-up. You could direct all traffic to server A, patch Server B and then repeat the other way around.

Alternatively, as @Curtisk states, better to get to the stage where you don't need to do "hot patches" through rigourous testing and then proceed to planned outages advertised in advance.

Hope this helps.

Paul Suart
+1  A: 

The reason why this happens is that deploying the new code causes the application pool to get recycled. You then loose everything you have in memory.

The way to get around this is then not to save anything in memory.

How difficult this is depends on your architecture.

One solution could be to save your session information in SQL Server, using the out of process state. Note do not use a in memory state server, as if the app pool is recycled you will loose this.

Shiraz Bhaiji