当 webroot 更改时防止会话结束

发布于 2024-10-05 09:53:27 字数 224 浏览 3 评论 0原文

我们的 Intranet 有一个自定义的会员资格系统(不是 asp 会员资格),它将值放入会话信息中以识别用户。由于内联网不断发展,我经常需要每天多次向实时服务器发布更改。每次我这样做时,登录的用户的会话都会结束,他们必须重新登录。这会导致各种问题,我不会在这里让任何人感到厌烦。

我的问题是——有什么办法可以防止这种情况发生,还是我只能忍受它?花了近3个小时的时间,没有找到任何解决方案。

提前致谢。

Our intranet has a custom membership system (not asp membership) which puts values in the session information to identify users. As the intranet is constantly evolving, I often have to publish changes to the live server several times every day. Each time I do, the users who are logged in's sessions end and they have to log in again. This causes various issues which I won't bore anybody with here.

My question - is there anyway to prevent this, or do I just have to live with it? Have spent the last 3 hours Goggling and can find no solution.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

三生池水覆流年 2024-10-12 09:53:27

解决方案是使用不同的会话模式;您正在使用“InProc”,这意味着会话与您的应用程序存储在同一应用程序空间中。您可以使用“StateServer”或“SQLServer”,但是这些可能需要更改应用程序(以及额外的设置;StateServer 将需要在 IIS Server 上运行单独的服务,而 SQLServer 将需要一个数据库来存储信息)。您存储在会话中的所有内容都需要可序列化。

以下是 MSDN 上有关会话模式的信息

The solution is to use a different Session Mode; You are using "InProc", which means the session is stored in the same application space as your application. You can use "StateServer" or "SQLServer", however these will likely require application changes (and additional setup; StateServer will require a separate service to be running on the IIS Server and SQLServer will require a database to store information in). Everything that you store in the Session will need to be serializable.

Here is the information on MSDN regarding Session Mode.

一场信仰旅途 2024-10-12 09:53:27

如果您的问题是如何保持服务器 24x7 运行而不会对用户造成任何干扰(会话丢失/系统停机等),那么它涉及以下步骤:

  1. 您应该配置应用程序以将会话存储在数据库中
  2. 您需要设置多个应用程序服务器作为故障转移策略
  3. 要将请求动态路由到其中一台服务器,您需要一个负载均衡器
  4. 现在,当您想要将下一版本的实时发布部署到应用程序时。服务器说S1和S2,请按照以下步骤操作:
    [4.1.] 更改负载均衡器配置,使其不将请求路由到 S1。
    [4.2.] 将应用程序部署到 S1
    [4.3.] 更改负载均衡器配置,这次包含 S1 并排除 S2。 (这样,所有后续请求都应命中 S1,从 S1 和 S2 连接的公共数据库获取会话信息)
    [4.4.] 根据需要重复上述步骤。

最重要的是,首先在现场/生产环境中执行上述步骤之前,请尝试始终在临时环境中测试上述步骤。

祝你好运!

If your question is about keeping your server up 24x7 without causing any disruption to users (loss of session/ system downtime, etc), then it involves the following steps:

  1. You should configure your application to store your sessions in DB
  2. You need to set up more than one app server as fail-over strategy
  3. To route requests to one of these servers dynamically, you'll need a load balancer
  4. Now, when you want to deploy the next version of release live to app. servers say S1 and S2, follow the steps below:
    [4.1.] Change your load balancer configuration for it to not route requests to S1.
    [4.2.] Deploy the apps to S1
    [4.3.] Change your load balancer configuration for it include S1 and exclude S2 this time. (With this all subsequent requests shall hit S1 getting the session info. from the common DB where S1 and S2 are connected)
    [4.4.] Repeat the above steps as required.

Most important of all try to always test the above steps in your staging environment before doing it first on live/production boxes.

Good luck!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文