为什么会话状态提供程序的更改会导致 ASPx 页面产生垃圾?
我有一个 aspnet web 应用程序,到目前为止一直运行良好。
最近,我被要求探索如何使其更好地扩展。
我发现数据库和 Web 应用程序的分离会有所帮助。
此外,我还被告知,如果我将会话提供机制更改为 SQLServer,我将能够将 Web 堆栈复制到多台机器,每台机器都可以回调状态服务器,从而更好地分配负载。
这听起来合乎逻辑。因此,我使用 ASPNet_RegSQL.exe 创建了一个 ASPState 数据库(如网络上许多位置的详细信息),并将我的应用程序上的 web.config 从: 更改
<sessionState mode="InProc" cookieless="false" timeout="20" />
为:
<sessionState mode="SQLServer"
sqlConnectionString="Server=SomeSQLServer;user=SomeUser;password=SomePassword"
cookieless="false" timeout="20" />
然后我解决了我的应用程序,它向我显示了其登录屏幕,我正式登录。
进入后,我看到的页面与我期望的页面不符。
我可以来回更改会话状态。这个问题会消失,然后根据我使用的配置集再次出现。
为什么会发生这种情况?
I have an aspnet webapp which has worked very well up until now.
I was recently asked to explore ways of making it scale better.
I found that seperation of database and Webapp would help.
Further I was told that if I changed my session providing mechanism to SQLServer, I would be able to duplicate the Web Stack to several machines which could each call back to the state server allowing the load to be distirbuted better.
This sounds logical. So I created an ASPState database using ASPNet_RegSQL.exe as detailed in many locations across the web and changed the web.config on my app from:
<sessionState mode="InProc" cookieless="false" timeout="20" />
To:
<sessionState mode="SQLServer"
sqlConnectionString="Server=SomeSQLServer;user=SomeUser;password=SomePassword"
cookieless="false" timeout="20" />
Then I addressed my app, which presented me with its logon screen and I duly logged in.
Once in I was presented, with a page that was not with the page I was expecting.
I can change the sessionstate back and forth. This problem goes away and then comes back based on which set of configuration I use.
Why is this happening?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不错的错误伙计:)
可能是一个转移注意力的问题,但是你在会话状态中存储什么?
当你从 InProc 迁移到 SQL Server 时,你在 SQL 中存储的内容必须是可序列化的(我认为)
Nice error Dude :)
Probably a red-herring, but what are you storing in Session state?
When you move from InProc to SQL Server, the stuff you store in SQL must be Serializable (I think)
使用 Fiddler 来查看网络上到底发生了什么。对我来说,当浏览器需要 HTML 时,您的应用程序似乎正在发送回图像。
Use Fiddler to see what's really going on over the wire. To me it looks like your app is sending back an image when the browser is expecting HTML.