ASP.NET 会话状态和多个工作进程 [英] ASP.NET session state and multiple worker processes

查看:22
本文介绍了ASP.NET 会话状态和多个工作进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要了解一些有关 ASP.NET 会话状态的信息,因为它适用于 IIS 7 和 ASP.net 3.5.

I need to understand something about ASP.NET session state, as it applies to IIS 7 and ASP.net 3.5.

如果一个应用程序被配置为使用进程内会话状态,那么如果有多个工作进程,它会正常工作吗?换句话说,工作进程是否共享会话状态?

If an application is configured to use in-process session state, will that work OK if there are multiple worker processes? In other words, do worker processes share session state?

IIS 7 的默认配置是使用进程内会话状态并分配最多 10 个工作进程.这样看来,这个默认配置应该可以工作.我正在与一家生产 ASP.NET MVC Web 应用程序的公司打交道,该应用程序存在一些问题,他们将责任归咎于服务器环境.声称是因为我使用了 10 个工作进程的默认设置,这破坏了它们的会话状态.我需要知道这是否真的是一个准确的说法.我从来不知道 ASP.NET 应用程序不能使用默认配置,所以我有点困惑,需要澄清一下.

The default configuration for IIS 7 is to use in-process session state and to allocate a maximum of 10 worker processes. It would seem likely then, that this default configuration should work. I'm dealing with a company that has produced an ASP.NET MVC web app that is having some problems, they're blaming the server environment. The claim is that because I'm using the default settings of 10 worker processes, that is breaking their session state. I need to know whether this is in fact an accurate claim. I've never known an ASP.NET app to not work with the default configuration, so I'm a bit confused and need to have this clarified.

推荐答案

拥有多个工作进程和使用 InProc 似乎不兼容.

Having multiple worker processes and using InProc does not seem to be compatible.

参见 这个:

如果您通过在应用程序的 Web.config 文件的 processModel 元素中将 webGarden 属性设置为 true 来启用 Web-garden 模式,请不要使用 InProc 会话状态模式.如果这样做,如果同一会话的不同请求由不同的工作进程提供服务,则可能会发生数据丢失.

If you enable Web-garden mode by setting the webGarden attribute to true in the processModel element of the application's Web.config file, do not use InProc session state mode. If you do, data loss can occur if different requests for the same session are served by different worker processes.

这篇关于ASP.NET 会话状态和多个工作进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆