4

I have checked the servers (Win Server 2003) application event logs for the following problem http://support.microsoft.com/kb/308097 which doesn't show up. It just appears that sessions drop randomly for random users

It's a single server setup, no web farms and no load balancing

Even though the issue I point to above doesn't occur in the logs, is it worth increasing the stateNetworkTimeout attribute anyway? The configuration at the moment is simply

<sessionState mode="StateServer" cookieless="false" stateConnectionString="tcpip=localhost:42424" timeout="60"/>

UPDATES:

Using FormsAuth and the Timeout is set to 60

IIS6 Settings

  1. Recycle worker processes (in minutes) = 120
  2. Recycle worker processes (number of requests) = 35000
  3. Recycle worker processes at the following times = Unchecked
  4. Maximum virtual memory = Unchecked
  5. Maximum used memory = Unchecked
  6. Shutdown worker processes after being idle = 90
  7. Limit the kernel request queue = 1500
  8. Everthing else = Unchecked
4

2 回答 2

4

我意识到这是一个较老的问题,但我最近遇到了类似的问题。在我的例子中,额外的日志显示会话变量似乎在一系列 .aspx 页面中随机丢失。

在偶然发现这篇博文之后,我查看了我的代码,果然,我所有的 Response.Redirect 语句要么是默认的(例如 Response.Redirect(target),要么是 true (例如 Response.Redirect(target, true) )。明智地之后查看我的重定向并将 Session 变量设置为 false 之后的重定向(例如 Response.Redirect(target, false) ) - 问题 [似乎] 解决了!我会注意,您在执行此操作时需要小心,因为当传递 false 时,页面的其余部分仍然会在重定向后执行。在许多情况下,我需要在重定向后添加一个 return 语句,以防止运行我不打算在重定向后运行的代码。

我只在生产和负载下(从未在开发或测试中)经历过丢失的会话变量。我关于为什么这解决了我的问题的理论是 Response.Redirect (default/true) 强制结束正在执行的线程——如果线程仍在忙于序列化会话对象并将它们放回状态服务器(线程)被中断,它们(会话对象)可能会丢失。

于 2013-06-26T22:22:41.167 回答
0

您还需要在表单身份验证部分设置超时(默认为 30 分钟)

http://weblogs.asp.net/scottgu/archive/2005/11/08/430011.aspx

于 2010-06-02T00:41:16.220 回答