Sunday, 15 July 2012

asp.net - SQL Server Session State, web farm, and IIS configuration -


So I have installed SQL Server session state using SQL Server 2008 and temporary database and today I look at data in it The table decided to find it only in the ASPStateTempApplications table:

AppId AppName
538231025 / LM / w3svc / 1 / root
611758131 / LM / w3svc / 3 / root
802488340 / Lm / and 3 S VC / 4 / Root
-940085065 / Lm / Y3 S VC / 4 / Route / WebApp
685293685 / Lm / 3 S VC / 5 / Route < Br /> 1210055478 / Lm / And 3 SVC / 5 / Root / webapp

We have 2 load balanced web servers

When I look at the web app ID of both servers then I think APP1 has 1 app with App4 and Web 2 in Web 1. The same thing happens with the second app in the web 1 is the app 2 with the ID of 1 and the web 2 has 3 id.

My general knowledge tells me that the web server sessions are not sharing because the session ID uses APIs, am I right? If so, why is it not so clear in this minor document? Should I match the IDs on both web servers?

The application ID is used during session creation, avoiding conflict from one app to another To help, it is created by calculating a hash of the IIS app path.

In your environment, the flow can be something like this:

  1. The server creates session IDs, sets it in a cookie, and some data in this session Stores (one line in ASPStateTempSessions) Session ID column is created by adding session ID to an app id.
  2. Server B receives a request with the session ID already present, and uses it to find session data related to ASPstatetampaign table. If the app ID is different, the generated key will also be different.

The net effect of multiple servers with different APIs sharing the same session is that the IDs created by one server won did not collide with them from other servers, and Machines will not see each other's sessions with different APIDs.


No comments:

Post a Comment