简体   繁体   English

SQL Server会话状态持久性如何工作?

[英]How does SQL Server session state persistence work?

I'm not a fan of using ASP.NET session state, but our application is using it at this time. 我不喜欢使用ASP.NET会话状态,但是我们的应用程序目前正在使用它。 We are using SQL Server mode for session state persistence. 我们正在使用SQL Server模式进行会话状态持久化。 I'm considering caching authorization check results in the session state, but I worry about the performance of this approach. 我正在考虑在会话状态下缓存授权检查结果,但是我担心这种方法的性能。 How exactly does SQL Server session state persistence work in .NET? .NET中SQL Server会话状态持久性到底如何工作?

From what I can tell, all session data is stored in one database row, with the data itself stored in one column. 据我所知,所有会话数据都存储在一个数据库行中,而数据本身存储在一列中。 My worry is that if our application does 12 different authorization checks in one request, and each result is stored immediately after received, that 12 different database requests would be made as those items are stored, which would nullify any network request reductions that I'm trying to accomplish. 我担心的是,如果我们的应用程序在一个请求中执行12个不同的授权检查,并且每个结果在收到后立即存储,那么在存储这些项目时将发出12个不同的数据库请求,这将使我减少的任何网络请求减少试图完成。

Is each session state mutation accompanied by a synchronous database request, or are all session state changes persisted at one time during the ASP.NET request life cycle? 是每个会话状态突变都伴随同步数据库请求,还是所有会话状态更改在ASP.NET请求生命周期中一次都持续存在?

ReleaseRequestState应用程序事件之后,会话将在每个ASP.NET请求的末尾ReleaseRequestState -而不是在会话数据更改时ReleaseRequestState

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM