丢失会话状态与ASP.NET/SQL服务器 [英] Losing Session State with ASP.NET/SQL Server

查看:103
本文介绍了丢失会话状态与ASP.NET/SQL服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经配置由负载平衡器管理的两个网站,一个ASP.NET MVC的工作流程。该网站使用SQL Server作为会话状态提供者和有身份验证关闭(它不需要)。

I have a ASP.NET MVC workflow configured as two websites managed by a load balancer. The websites use Sql Server as the session state provider and have authentication switch off (its not required).

现在,偶尔我似乎失去会话状态,我相信这是因为请求正在被替代服务器来处理,所以本质上用户是跳跃从服务器到服务器,根据不同的负载平衡器如何认为合适的。我并不总是丢失会话状态在工作流程相同的阶段,所以我相信这是一些相关的Web场配置+ SQL Server会话状态。

Now, sporadically I appear to be losing session state, and I believe this is because the request is being handled by the alternative server, so essentially the user is jumping from server to server, depending how the load balancer sees fit. I am not always "losing session state" at the same stage in the workflow, so I believe it is something related to the web farm configuration + sql server session state.

这两个应用程序使用同一台机器密钥来加密和解密存储在SQL Server会话状态。

Both applications use the same machine key to encrypt and decrypt session state stored in sql server.

在两台服务器上的配置如下:

The configuration on both servers is as follows:

<authentication mode="None" />
<sessionState mode="SQLServer" sqlConnectionString="{connection-string}" />
<machineKey decryptionKey="777CB456774AF02F7F1AC8570FAF31545B156354D9E2DAAD" 
            validationKey="89B5B536D5D17B8FE6A53CBB3CA8B8695289BA3DF0B1370BC47D362D375CF91525DDB5307D8A288230DCD4B3931D23AED4E223955C45CFF2AF66BCC422EC7ECD" />

我确认这是完全相同的两台服务器上,是有什么我失踪?

I've confirmed that this is identical on both servers, is there something I am missing?

当我使用一台服务器这并不在我的开发环境中进行。

This does not occur in my development environment when I am using a single server.

我怕我从周五蓝调痛苦,下周无疑将找出答案,可惜我不想等待!

I fear I am suffering from the Friday blues, and no doubt will figure out the answer next week, sadly I don't want to wait!

任何想法?

推荐答案

发现的问题。

当您创建希望使用SQL Server共享会话状态的应用程序,他们需要在IIS中配置相同的ID。这是因为,是根据该应用程序的ID生成所生成的会话ID。 (内部应用程序ID是一样的东西的 LM / W3SVC / 1

When you create applications that you expect to share session state using Sql Server, they need the same ID configured in IIS. This is because the session ID that is generated is generated based on the application ID. (Internally the application ID is something like LM/W3SVC/1

这两台服务器必须在IIS中的每个应用程序不同的ID。解决方法是改变在'管理网站上的ID - 每个服务器上>高级设置

The two servers had different IDs for each application in IIS. The resolution is to change the ID under `Manage Website -> Advanced Settings' on each server.

这篇关于丢失会话状态与ASP.NET/SQL服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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