ASP.NET - different SessionId on servers when a session is stored in SQL Server

I manage the state of a shared session on two production web servers using a SQL Server database.
I recently realized (and I'm pretty sure that this was not the case before) that the session is really not used when switching from server to server.

Both servers run the same site in the same domain and balance using a hardware load balancer. Both work under IIS7. Both servers are running the ASP.NET State Service.

While checking the HTTP headers and cross-references to capture the SQL profiler, I found what I think might be the problem.

The SessionId value in my cookies is a 24 character string, for example: y4hfairc2xbwlupkdsqpv0nz

The SessionID received in the ASPState database and stored there is longer and has an 8-digit postfix for the server. for example 2476b033 or 2b7731d2 , which is consistent across all sessions stored in the database.
Therefore, SessionID look like this: y4hfairc2xbwlupkdsqpv0nz2476b033 or y4hfairc2xbwlupkdsqpv0nz2b7731d2

Obviously, because of this, the session is not shared, and each server maintains its own session state.

Anyone using a similar configuration that could have come before this?

thanks

Update

It turns out here: The SessionId stored in SQL Server is different from the one generated from the asp.net runtime in that the extra characters are the IIS AppID. Now I have to learn how to change it so that both servers match each other. So far no luck.
Is anyone

+4
source share
1 answer

Answering my question on completeness.

Thanks to this: https://serverfault.com/questions/288981/load-balanced-iis-7-5-web-server-asp-net-session-state-problem

I found out how to map an AppID.

Everything seems to be working fine now.

+3
source

All Articles