This article was previously published under Q323262
This article describes the information that you must have to configure a Web server cluster to use the SQL session state that runs in a failover cluster. If you anticipate many requests on your Microsoft ASP.NET applications, you may install a Web farm of Web servers that are running on Windows Network Load Balancing (WNLB).
By using WNLB, you can reveal a virtual access point to your users. WNLB shares the workload across all members of the Web farm transparently. If your Web application uses a session, you can store the ASP.NET session state in SQL Server to gain more reliability and to improve virtual access for the users.
ASP.NET offers significant versatility in saving a session state. This solves most problems that may occur while you run earlier ASP applications in a Web farm. You can configure the Web.config file of a particular application to use the SQL session state on a failover cluster.
Microsoft SQL Server offers you centralized storage of a session state in a Web farm. It also offers the transactional capabilities that provide reliability to most relational database systems. You can use SQL Server to save a session.
Configure ASP.NET to store session state in SQL Server
When you set the value of the mode attribute to SqlServer in the sessionState element of the Web.config file, an ASP.NET worker process stores the objects that belong to the client session collection in SQL Server at the end of each Web request.
For additional information about how to install SQL session state in a SQL Server cluster, click the following article number to view the article in the Microsoft Knowledge Base:
311209 How to configure ASP.NET for persistent SQL Server session state management
For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
317604 How to configure SQL Server to store ASP.NET session state
To store the ASP.NET session state in SQL Server, change the <sessionState> element in the Web.config file as follows:
Note Make sure that the Web farm of Web servers is set up, and that SQL Server Services are started before you run the Web application.
Type any string in the first text box, and then click Set Session Value.
The session state is stored in SQL Server with a unique session ID. Examine the session state that is stored in the ASPStateTempSessions table of the ASPState database.
Stop the first Web Server that your request is processed from.
In the browser, click Get Session Value.
Note that the string that is stored in the session by the first Web server appears in the text box although the first Web server is stopped. The second Web server runs the service for the request.
Note Because of a bug in the System.data.dll file in the Microsoft .NET Framework 1.0 and the .NET Framework 1.1, SqlConnections that were connected to the old (now stopped) SQL Server-based server will still be kept in the connection pool. Therefore, you may see some errors in the request because ASP.NET is still using those dead connections in a browser. But when all these pooled dead connections are used and discarded, it will start working again.
For additional information, click the following article numbers to view the articles in the Microsoft Knowledge Base: