Using one SQL database for all applications for SQL Server session state may cause a bottleneck (820782)



The information in this article applies to:

  • Microsoft .NET Framework 1.0
  • Microsoft ASP.NET (included with the .NET Framework) 1.0
  • Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Architect Edition SP1
  • Microsoft Visual Studio .NET (2002), Enterprise Developer Edition

For a Microsoft .NET Framework 1.1 version of this article, see 836680.

SYMPTOMS

You can use Microsoft SQL Server version 7.0 or later to maintain session state in ASP.NET. For more information about how to configure SQL Server session state in ASP.NET, see the "References" section of this article.

SQL Server session state provides a longer and scalable use of session state in ASP.NET. However, it uses the same SQL Server database for all applications that are in the same ASPNET process. This behavior may create a single point of failure or may create a bottleneck.

CAUSE

By design, all ASP.NET applications use the same database to store data when they use SQL Server session state. You cannot specify a database name for each application. However, after you apply this hotfix, you can include the database name in the SQL connection string of a configuration file in the sessionstate section.

RESOLUTION

If SQL Server session state is currently configured, remove it by using the original UninstallSqlState.sql script before you install this fix. For more information, see the "References" section of this article.

The hotfix will install new InstallSqlStateTemplate.sql and UninstallSqlStateTemplate.sql files. Make a copy of these files for each Session database that you want to create. Modify each respective file by following the instructions that appear in the "More Information" section of this article.

Note These instructions are also included in the comment section of the InstallSqlStateTemplate.sql file.

After you have completed the modifications, run the InstallSqlStateTemplate.sql file to install SQL Server session state for a specified database. After you configure the Session database, modify the Web.config sessionstate section to reference a specific database for the session state, as in the following example:

Note In the following sample code, you must change user id=<username> and password=<strong password> to the correct values. Make sure that the user ID has the appropriate permissions to perform this operation on the database.
<sessionState 
     mode="SQLServer"
     allowCustomSqlDatabase="true" <!--This line is a new attribute to sessionState. --> 
     sqlConnectionString="data source=127.0.0.1;database=mydatabase;user id=<username>;password=<strong password>"
     cookieless="false" 
     timeout="20" 
/>
Note The sqlConnectionString now contains a parameter for database. In this example, mydatabase is the database that you specify for the session state.

A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, Microsoft recommends that you wait for the next .NET Framework 1.0 service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English version of this hotfix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
   Date         Time   Version       Size       File name
   ---------------------------------------------------------------------------------------------
   22-Sep-2003  19:32  1.0.3705.459    200,704  Aspnet_isapi.dll
   22-Sep-2003  19:26                    4,169  Aspnet_perf.h
   22-Sep-2003  19:33                  513,302  Aspnet_perf.ini
   22-Sep-2003  19:33                  510,714  Aspnet_perf2.ini
   22-Sep-2003  19:32  1.0.3705.459     24,576  Aspnet_regiis.exe
   22-Sep-2003  19:33  1.0.3705.459     28,672  Aspnet_wp.exe
   22-Sep-2003  18:46  1.0.3705.459     69,632  Corperfmonext.dll
   17-Jun-2003  22:43                   16,597  Installpersistsqlstate.sql
   17-Jun-2003  22:43                   17,331  Installsqlstate.sql
   09-Sep-2003  01:28                   17,807  Installsqlstatetemplate.sql
   22-Sep-2003  18:44  1.0.3705.459    303,104  Mscorjit.dll
   23-Sep-2003  21:34  1.0.3705.459  1,953,792  Mscorlib.dll
   22-Sep-2003  18:37                   10,284  Mscorlib.ldo
   22-Sep-2003  18:45  1.0.3705.459  2,273,280  Mscorsvr.dll
   22-Sep-2003  18:45  1.0.3705.459  2,269,184  Mscorwks.dll
   22-Sep-2003  19:30  1.0.3705.459     20,480  Perfcounter.dll
   23-Aug-2002  03:23                       15  Smartnav.htm
   30-Jul-2003  01:04                    8,728  Smartnav.js
   23-Sep-2003  21:33  1.0.3705.459  1,175,552  System.dll
   23-Sep-2003  21:32  1.0.3705.459    241,664  System.messaging.dll
   23-Sep-2003  21:32  1.0.3705.459    311,296  System.runtime.remoting.dll
   23-Sep-2003  21:31  1.0.3705.459    131,072  System.runtime.serialization.formatters.soap.dll
   23-Sep-2003  21:34  1.0.3705.459  1,196,032  System.web.dll
   23-Sep-2003  21:32  1.0.3705.459    507,904  System.web.services.dll
   23-Sep-2003  21:34  1.0.3705.459  1,302,528  System.xml.dll
   23-Sep-2003  21:30  1.0.3705.459     32,768  Tlbimp.exe
   17-Jun-2003  22:43                    1,419  Uninstallpersistsqlstate.sql
   09-Sep-2003  01:28                    2,119  Uninstallsqlstatetemplate.sql
   23-Sep-2003  21:30  1.0.3705.459     65,536  Wsdl.exe

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

Use the templates files to install the ASP.NET session state SQL objects

Use the templates files to install the ASP.NET session state SQL objects on a database other than the default ASPState database. To do this, follow these steps:
  1. Create your own script files by coping the two template files.
  2. Create a name for your database (such as MyASPStateDB).
  3. In your own script files, replace all occurrences of DatabaseNamePlaceHolder with the name of your database.
  4. Install and remove ASP.NET session state SQL objects by using your own script files.

REFERENCES

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


Modification Type:MinorLast Reviewed:10/25/2005
Keywords:kbHotfixServer kbQFE kbvs2002sp1sweep kbQFE kbNetFrame100preSP3fix kbSQLProg kbConfig kbfix kbcode kbBug KB820782 kbAudDeveloper