更新1:还有关于幸存应用程序池的回收?
更新2:会话的长寿及其结局如何?
解决方法
In process. In process will perform best because the session state memory is kept within the ASP.NET process. For Web applications hosted on a single server,applications in which the user is guaranteed to be re-directed to the correct server,or when session state data is not critical (in the sense that it can be re-constructed or re-populated),this is the mode to choose.
Out of process. This mode is best used when performance is important but you can’t guarantee which server a user will request an application from. With out-of-process mode,you get the performance of reading from memory and the reliability of a separate process that manages the state for all servers.
sql Server. This mode is best used when the reliability of the data is fundamental to the stability of the application,as the database can be clustered for failure scenarios. The performance isn’t as fast as out of process,but the tradeoff is the higher level of reliability.
进程外(也称为“状态服务器”)和sql Server服务器选项都可以在Web应用程序重新启动(包括应用程序池循环)中运行,并且都可以将会话数据提供给群集/服务器场中的多个服务器。
最后,它可能不用说,但基本的进程内设置是最简单的配置,这在许多环境中是一个有意义的“亲”。
Tim Sneath的ASP.NET Session State: Architectural and Performance Considerations增加了一些额外的信息,MSDN topic on Session State Modes是一个可靠的最新来源。