asp.net session state mode "SQLServer"
Solution 1
Open "Programmability" in your tree and check first if dbo.TempGetVersion exists. Probably you have not installed the proper schema.
Solution 2
In order to get this to work for me I ran the command with the following options.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regsql.exe -S . -E -ssadd -sstype p
I believe the -ssadd
option ("Adds support for SQL Server mode session state.") is what caused it to properly set up the stored procedures. See this link for to complete list of option.
Solution 3
All this information is extremely valuable but there are a couple more valuable notes depending on your situation.
If you ran the wizard it does not run with the -ssadd flag. The -ssadd flag is what creates the dbo.TempGetVersion procedure and other procedures as well.
If you are going to a custom server/database you will want to run the program as follows...
aspnet_regsql.exe -S YourServerName -d YourDatabaseName -ssadd -E -sstype c
- -S is your servername flag
- -D is your database name flag
- -ssadd Adds support for SQLServerm mode session state. Run -ssremove if you need to remove the procedures.
- -E uses the current Windows credentials to connect to the target database to set things up.
- -sstype c says that this is a custom database name.
Solution 4
Maybe you have a bad tag in your web.config
A correct example should be:
<sessionState
allowCustomSqlDatabase="true"
mode="SQLServer"
sqlConnectionString="data source=localhost;initial catalog=YourAspStateDatabase;user id=yourLogin;password=yourpassword" cookieless="false" timeout="30"/>
Jack
Updated on March 11, 2022Comments
-
Jack about 2 years
"My website is LIVE. And this problem is related to configure session timeout on LIVE server and not in localhost."
I have a problem with session expiring too soon. link in 2-5 minutes only. I tried lot of things and at last decided to store the session in "SQL Server" mode
in my web.config file i have following coding:
<sessionState mode="SQLServer" cookieless="false" timeout="45" sqlConnectionString="data source=xxx.xx.xx.xxx;uid=xxxxxxx;pwd=xxxxxxxx"/>
and i have all the tables required in ASPState table on server. You can see it from the image below.
But i when i run my application, its throws the below error:
"Unable to use SQL Server because either ASP.NET version 2.0 Session State is not installed on the SQL server, or ASP.NET does not have permission to run the dbo.TempGetVersion stored procedure. If the ASP.NET Session State schema has not been installed, please install ASP.NET Session State SQL Server version 2.0 or above. If the schema has been installed, please grant execute permission on the dbo.TempGetVersion stored procedure to either the ASP.NET application pool identity, or the Sql Server user specified in the sqlConnectionString attribute."
Image of the error:
I am not able to understand the exact problem and how i can solve it. Any help will be appreciated.
Thank You
-
DSharper about 11 yearsDid you try giving DbExecuter role permission to your user id which is in your connection string
-
Jack about 11 yearsno i have not tried anything like that.
-
Victor Yarema over 7 years@jackerj, you wrote "and i have all the tables required in ASPState table on server". First, looks like you mean "ASPState db" when you wrote "ASPState table". Am I correct? Another question is: how did you check that those tables that you have found in the db are exactly what should be there?
-
-
Jack about 11 yearsactually i have installed it on local server, and export the database on the server.
-
Jack about 11 yearsi dont know any way to directly install it on the server database
-
Jack about 11 yearsdid what you said. istalled it again, now getting following error "Invalid object name 'tempdb.dbo.ASPStateTempApplications'" can you tell me anything about it?
-
Pleun about 11 yearsYou installed it in temdb, not in your regular database perhaps?
-
Naveed Butt about 11 yearsI am having the exactly same issue, with the problem that the above mentioned stored procedure does not exist in the list of 55 stored procedures created by
aspnet_regsql -W
-
Kenn about 10 years"Probably you have not installed the proper schema." It would help if you told us what scheme was correct? I have this same issue - I can see that I don't have that stored proc but why didn't it get set up when aspnet_reqsql?
-
Pleun about 10 yearsIt is called ASP.NET session state schema as you can see in the screenshot. Are you sure you were connected to the correct database when you executed aspnet_reqsql??
-
WhiskerBiscuit almost 10 yearsThis worked for me on a freshly installed machine. You can alos run this from a VS command prompt
-
Adam Hey about 3 yearsAfter trying many variations of the apsnet_regsql.exe command args, this is the one that worked for me. The others did not install the necessary stored procs
-
osmanraifgunes about 3 years"aspnet_regsql.exe -W" is easier to configure. It opens gui.