Reputation: 117
I need to recycle a IIS application pool for once a week and before recycling need to make sure all active sessions in App pool are closed. Is there a way? using .net.
Upvotes: 3
Views: 592
Reputation: 39284
The IIS recycling is usually "overlapped", meaning that requests aren't cut off: running requests are allowed to continue, while new requests are served by the new pool-instance. See here.
But this doesn't help you for sessions (which span multiple requests). An InProc Session will be abandoned by a recycle. You could however store the session-state out-of-process, with StateServer or SqlServer, so it is safe from recycles. See here.
Upvotes: 4
Reputation: 171178
How might that be possible? A session can take many minutes to be shut down. So it is impractical to wait for them.
I think you are asking the wrong question. You should ask "Can I prevent all sessions being destroyed on a recycle?". Answer: Yes. Use StateServer
mode.
Upvotes: 0