Asp.Net如何将会话状态传输到状态服务器
我需要将 Asp.Net 应用程序的会话状态传输到状态服务器。有没有人有关于如何做到这一点的经验?
谢谢 。
I need to transfer session state of an Asp.Net application to a state server. Does any one have any experience about how to do it?
Thanks .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您想使用 SQL Server 作为会话状态服务器,请将此代码段放入您的 web.config 中:
请记住,为了将会话序列化到状态服务器,您应该仅放入会话可序列化的对象,否则你会得到异常。
我们过去也遇到过这个问题,必须检查代码中的所有地方,并使存储在会话中的所有对象可序列化;对于某些课程来说很容易,而另一些课程则较少。
您还可以阅读这篇文章:使用 SQL Server 获取 ASP.Net 会话状态 或任何其他文章你可以在网上找到;-)
编辑: 对于 StateServer,你应该将 web.config 中的模式属性更改为值:StateServer。
为此,SO 中也有文章、示例和讨论:
ASP.NET:使用 StateServer 将会话移至进程外(ASP.NET 中的冒险)
扩展 ASP.NET 会话状态服务器 (SO)
if you want to use SQL Server as session state server, put this snippet in your web.config:
keep in mind that in order to have the Session Serialized to a State Server you should put in the Session only serializable objects, or you will get exceptions.
We had this problem in the past and had to check everywhere in the code and make all objects stored in the session Serializable; for some classes it's easy for others is less.
you can also read this article: Using SQL Server for ASP.Net session state or any other article you find online ;-)
Edit: for the StateServer you should change the mode attribute in the web.config to the value: StateServer.
also for this there are articles and examples and discussions also in SO:
ASP.NET: Moving Session Out-of-Process with StateServer (Adventures in ASP.NET)
Scaling up the ASP.NET session state server (SO)
第 1 步:在 web.config 的 System.Web 配置部分添加以下
第 2 步:从
Control Panel =>管理工具=> Services
,启动名为“ASP.NET State Service
”的服务,就是这样。
Step 1: In System.Web configuration section of web.config add following
Step 2: From
Control Panel => Administrative tools => Services
, start the service called as "ASP.NET State Service
"thats it.