asp.net session state mode “SQLServer”

怎甘沉沦 提交于 2019-12-03 05:40:48

Open "Programmability" in your tree and check first if dbo.TempGetVersion exists. Probably you have not installed the proper schema.

Kenn

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.

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"/>

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.

I was stuck with this and none of the answers worked for me, just in case someone else have this problem, this was what solved my problem, I ran in the cmd:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regsql.exe -C "Data Source=.\SQL2012;Integrated Security=True" -ssadd

Just in case someone else gets stuck in the same situation as me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!