会话状态奇怪的行为
我有一个 ASP.NET 3.5 Webforms 应用程序,它位于两个 Web 服务器 (IIS) 上,并通过具有粘性亲和力的内容交换机进行负载平衡。我有一个页面将数据放入会话变量中,javascript 打开一个新的浏览器窗口,在该页面的 page_load 事件中,我检索该会话变量并显示数据。
问题是,在所有版本的 IE 中,大约十分之七的情况是没有数据显示的。如果我不断刷新新打开的窗口,它最终会显示数据。我可以验证在打开浏览器窗口之前,会话变量是否有效。
另一个问题是 Firefox 没有这个问题。第一次就100%显示数据。问题是我们不(正式)支持 Firefox。
我们无法访问任何第三方数据存储,例如 MSSQL 或 MySQL,因此无法存储会话数据。另外,缓存数据客户端的能力并不实用,在某些情况下也不是一种选择。
这不会在本地或我们的测试环境中发生(没有负载平衡),所以我真的很困惑。任何帮助将不胜感激。
谢谢。
I have an ASP.NET 3.5 webforms app that sits on two webservers (IIS) and is load balanced via a content switch with sticky affinity. I have a page that puts data into a session variable, javascript opens a new browser window, and in the page_load event of that page, i retrieve that session variable and display the data.
the problem is that in all versions of IE, about 7 times out of ten, no data is displayed. If i keep refreshing the newly opened window, it will eventually display the data. I can verify that before that browser window is opened, the session variable is valid.
An additional twist is that firefox doesn't have this issue. The data is displayed 100% of the time the first time. The problem is we don't (officially) support firefox.
We don't have access to any third party datastore such as MSSQL or MySQL, so storing session data there isn't an option. Plus the ability to cache the data client side isn't practical and in some cases not an option.
This doesn't happen locally or in our test environment (which isn't load balanced), so i'm truly baffled. Any help would be greatly appreciated.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您使用什么会话存储提供商?进程内、状态服务器?听起来好像您正在使用 InProc。如果是这样,由于您无权访问数据库,因此切换到 StateServer 可能是您的答案。
这是一篇关于 ASP.NET 负载平衡和 ASP.NET 状态服务器可能会对您有所帮助。
What session store provider are you using? InProc, StateServer? It sounds like you're using InProc. If so, since you don't have access to a DB, switching to StateServer may be your answer.
Here's an article about ASP.NET load balancing and ASP.NET state server that may help you.
您提到您正在使用粘性会话/关联性。您能否确认您的负载均衡器正在查看 HTTP cookie(不仅仅是 IP 地址)来确定粘性,因为 IP 地址可能会在单个会话期间发生变化(例如,在有线和无线网络之间连接笔记本电脑)。
You mentioned that you are using sticky session/affinity. Can you confirm that your load balancer is looking at HTTP cookies (not only IP address) to determine stickiness, since IP addresses can change during a single session (e.g. docking a laptop between a wired and wireless network).