是否有必要创建与现有 ASP.NET 2.0 ASPState DB 不同的 ASP.NET 4.0 SQL 会话状态数据库?
ASP.NET 4.0 SQL 会话状态机制是否向后兼容 ASP.NET 2.0 会话状态架构,或者我们应该/必须为 ASP.NET 4.0 创建一个单独且不同的会话状态数据库应用程序?
无论如何,我倾向于后者,但 2.0 数据库似乎可以正常工作,尽管我想知道 2.0 和 4.0 版本之间的 ASPState 数据库架构/过程之间是否存在任何实质性差异ASP.NET。谢谢。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
任何人都没有对此做出快速回答,所以我做了一些挖掘。我使用 .NET 2.0 中的
aspnet_regsql.exe
工具生成了ASPState
数据库,然后使用 .NET 4.0 中的相同工具执行了相同的操作。然后,我从每个生成的 SQL Server 数据库生成脚本,并使用比较工具来隔离差异。我发现:.NET 2.0 到 .NET 4.0 版本的
ASPState
架构之间的唯一实质性区别是dbo.DeleteExpiredSessions
存储过程。 这是由 SQL Server 代理计划作业(也由该工具安装)定期调用的存储过程。因此,ASPState 2.0 和 ASPState 4.0 的架构似乎完全兼容,因此从技术角度来看,没有必要隔离 ASP.NET 2.0 和 ASP.NET 4.0 会话状态 - 但是无论如何我很可能会这么做。
(这个发现有点令人惊讶,因为 ASPState 从 .NET 1.1 到 .NET 2.0 发生了很大变化。)
每个版本更改的存储过程的详细信息:
.NET 2.0 ASPState DeleteExpiredSessions 存储过程:
.NET 4.0 ASPState DeleteExpiredSessions 存储过程:
至于为什么上述更改是必要的,我发现以下 MSDN 博客文章:
摘录,参考旧过程:
因此,较新版本的存储过程可能也适用于 ASP.NET 2.0 应用程序。
我从博客文章中了解到另一件事我不知道:ASP.NET 4.0 会话状态机制现在提供压缩。在 compressionEnabled ="nofollow noreferrer">sessionState 元素(ASP.NET 设置架构)。
最后,我还刚刚在 ASP.NET 并行执行概述。摘抄:
(尽管在实现上存在一些差异,但不特定于架构。)
There was no quick answer on this from anybody, so I did some digging. I generated an
ASPState
database using theaspnet_regsql.exe
tool from .NET 2.0, and then I did the same thing using the same tool but from .NET 4.0. Then, I generated scripts from each of those resulting SQL Server databases and used a comparison tool to isolate the differences.What I found is: The only material difference between the
ASPState
schema from .NET 2.0 to .NET 4.0 versions is thedbo.DeleteExpiredSessions
stored procedure. That's the stored procedure called periodically by a SQL Server Agent scheduled job also installed by the tool.Consequently, it would seem that the schema for ASPState 2.0 and ASPState 4.0 are perfectly compatible and so it's not necessary, from a technical standpoint, to segregate ASP.NET 2.0 and ASP.NET 4.0 session state – but I'll likely do it anyway.
(This finding was a bit surprising, as ASPState changed a lot from .NET 1.1 to .NET 2.0.)
Details for each version's changed stored proc:
.NET 2.0 ASPState DeleteExpiredSessions stored procedure:
.NET 4.0 ASPState DeleteExpiredSessions stored procedure:
As for why the above change was necessary, I found the following MSDN blog post:
Excerpt, in reference to the older procedure:
Consequently, the newer version of the stored proc may be advisable for ASP.NET 2.0 apps, too.
One more thing I learned from the blog post that I did not know: ASP.NET 4.0 session state mechanism now offers compression. Search on
compressionEnabled
at sessionState Element (ASP.NET Settings Schema).Finally, I also just found something relevant from Microsoft, at ASP.NET Side-by-Side Execution Overview. Excerpt:
(Though there are some differences in implementation not specific to the schema.)