Friday, August 28, 2009

Problems in configuring sql server for session mode sql server

Before going to details let me explain my experience on this. I was working on a project which pushed us to use bulky data in session. So we thought that it wouldn't be reliable to use the session in "InProc" mode as the asp.net worker process consumes lot of RAM and leads to crash the service. To avoid this we decided to use the session state in sql server mode. Telling the asp.net application to use sql server for session state is easy as shown below.


But to make the above to work, we need to setup the sql server which is mentioned in connection string above. To do this, I did the following steps mentioned in some article found in Google search.

  1. Find the file 'aspnet_regsql.exe' in the location 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727'.
  2. Run the aspnet_regsql.exe.
  3. Follow the wizard with all default values till the wizard finishes.
  4. Verify that a new database is created in the sql server.
It all looked perfect for me and when I tested my application I got an error saying "Cannot open database requested in login 'ASPState'. The asp.net framework was look for the database 'ASPState' but when I looked at the sql server I have noticed that the setup has created 'aspnetdb' instead of 'ASPState'. Then I have changed the config to use the database 'aspnetdb' as show below.


This time I got a different exception.
"Unable to use SQL Server because ASP.NET version 2.0 Session State is not installed on the SQL server. Please install ASP.NET Session State SQL Server version 2.0 or above."

To solve these problems I did a long research and found a way.
  1. Open command prompt
  2. Change the current directory to 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727'.
  3. Run aspnet_regsql.exe -S SqlServer -E -ssadd -sstype p
  4. You will notice the database 'ASPState' created in the sql server give
  5. That's it. Your application is ready to use the sql server to store the session state.

Shout it

1 comments:

Cognegic said...

How to Configure SQL Server to Manage ASP.NET Sessions? Contact to DB Administration Tool

In the event that you need to arrange SQL Server to deal with your ASP.NET sessions so as a matter of first importance you have to make a session database, for this: first search for the aspnet_regsql.exe and after that you need to run this summon. By along these lines you can design it. In any case, of you any many-sided quality in regards to this designing this then you need to connect with DB Installation and DB Configuration Support or DB Configuration Tool. With our specialized specialists you 'can without much of a stretch understand your establishment issue or arrangement issue in an inventive way.

For More Info: https://cognegicsystems.com/
Contact Number: 1-800-450-8670
Email Address- info@cognegicsystems.com
Company’s Address- 507 Copper Square Drive Bethel Connecticut (USA) 06801