在服务器群InProc会话使用 [英] InProc session usage in server farms

查看:144
本文介绍了在服务器群InProc会话使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在读ASP.NET 4偷跑,我来到了这句话。 当会话状态存储在进程,它是存储特定的Web服务器上。换句话说,你不能使用进程内会话状态与Web农场。

I'm reading ASP.NET 4 Unleashed and I came to this sentence. "When Session state is stored in-process, it is stored on a particular web server. In other words, you can't use in-process Session state with a web farm."

哎呀。我建立一个使用和依赖于会话存储字典的web应用程序。现在我知道使用会话但会话是InProc,有那么我想我会没事的没有序列化时有一些问题,字典的序列化。但现在我想知道:将我有什么讨厌的惊喜,当我去主持我的应用

Ooops. I'm building a web app that uses and depends on storing dictionaries in the session. Now I know that there's some problem with serialization of dictionaries when using sessions but with InProc sessions, there's no serialization so I thought I'd be ok. But now I'm wondering: will I have any nasty surprise when I go to host my application?

感谢。

推荐答案

首先,如果你的应用程序在一台服务器上运行(也可能是一个共享的主机),在进程内会话确定,可能是唯一的出路。

First of, if your app runs on a single server (and possibly on a shared hosting), in-proc session is OK and probably the only way to go.

但是,如果你有多个服务器(Web农场),或连服你的网站(Web园)在同一台服务器上有多个进程在进程内将无法正常工作的除非您使用粘性会话:负载平衡器将需要配置在会话开始后,将请求发送到同一台服务器

But, if you have more than one server (web farm) or even more than one process on the same server serving your web site (web garden) in-proc will not work unless you use sticky sessions: your load balancer will need to be configured to send requests to the same server after the session is started.

不要担心词典系列化,会话处理必须能够梳理出来,无论是状态服务器或SQL Server。

Do not worry about dictionary serialisation, session handling must be able to sort it out, be it state server or SQL Server.

然而,一般来说,在一个进程内会话或国家限定的进程边界被认为是不好的设计,并强烈建议不要任何的依赖。

这篇关于在服务器群InProc会话使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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