When web farm is in place, suddenly some of the straightforward tasks are becoming more compelling. This one is about session state data hosted in the sql server.
By design ASP.NET sql session state implementation relies on one table to keep the application names and one to keep sessions.
The sessionId in the session table is created by concatenation of the asp.net session id and the corresponding AppId. The identifier that is unique across farms is achieved by this, but this is coming for the price of applications having to share the same ID in the IIS metabase. Otherwise, session entry created by one server in the farm can't be matched by the other one. It could be really nice if one would be able to assign this identifier in the web.config session state configuration element.
First step we tried was to just find and replace all metabase entries for this web site/application with id that would be the same on all servers. That didn't work and web site was not operable after this change. Ok, after having the problem narrowed down, google search led to the following:
The suggested script ran alright and reported DONE, BUT sites were not operable after running it (always tried on the original working copy of the metabase).
As time was pressing, we just saved the web site to the file and restored it on the other server. After changing values that should be unique for each server (like IP address), we ended up with working solution.
Bits of extra info from analysis:
Sample of a web site identifier in the metabase:
The applications table sample content. Highlighted in green are the different IIS app identifiers before fixing the issue.