If i understand you well, you are trying to configure MS SQL Server database to store information about session state. If yes, please follow the steps from here:
ASP.NET Session State with SQL Server In-Memory OLTP | SQL Database Engine Blog[
^]
Seems, that one of the most important things, is:
Note:
To configure SQLServer mode for a Web farm, in the configuration file for each Web server, set the sessionState element's sqlConnectionString attribute to point to the same SQL Server database. The path for the ASP.NET application in the IIS metabase must be identical on all Web servers that share session state in the SQL Server database. (...)
If you specify a trusted connection to your SQL Server in the configuration file using the sessionState element's sqlConnectionString attribute, the SessionStateModule will connect to SQL Server using SQL Server integrated security. The connection will be made using the ASP.NET process identity or the user credentials supplied for the identity configuration element, if they exist. You can specify that the IIS impersonated identity be used instead by specifying <identity impersonate="true" />
and setting the useHostingIdentity
attribute of the sessionState configuration element to false
. For more information on the ASP.NET process identity, see Configuring ASP.NET Process Identity[^] and ASP.NET Impersonation[^].
Source:
Session-State Modes | Microsoft Docs[
^]
For further details, please see:
ASP.NET Session State Overview | Microsoft Docs[
^]