Losing Session State with ASP.NET/SQL Server

后端 未结 3 440
半阙折子戏
半阙折子戏 2020-12-02 19:18

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

相关标签:
3条回答
  • 2020-12-02 19:41

    Found the issue.

    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

    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.

    enter image description here

    0 讨论(0)
  • 2020-12-02 19:54

    Sessions have (web) application scope. See if this MS KB helps.

    Update: Interesting down vote. Perhaps my suggestion needs more clarity.

    In addition to matching machine keys, you also have to match the IIS configuration for sites (so it's the "same application" (application path) in IIS.

    0 讨论(0)
  • 2020-12-02 19:59
    1. Using IIS Manager, double-check your machine key settings at both the root and website levels.

    enter image description here

    1. Review the IsolateApps modifier on the machine key element - http://msdn.microsoft.com/en-us/library/w8h3skw9%28v=vs.100%29.aspx

    2. Did you recently upgrade from 3.5 to 4.0?

    3. Last resort - recycle the appPools on both machines, and restart IIS.

    0 讨论(0)
提交回复
热议问题