asp.net会话状态模式“SQLServer”

时间:2023-01-16 09:48:27

"My website is LIVE. And this problem is related to configure session timeout on LIVE server and not in localhost."

“我的网站是生活。这个问题与在LIVE服务器上配置会话超时有关,而不是在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

我有一个问题,会议过早结束。链接2-5分钟。我尝试了很多东西,最后决定以“SQL Server”模式存储会话

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.

我在服务器上有ASPState表中需要的所有表。你可以从下面的图片中看到它。

asp.net会话状态模式“SQLServer”

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

“不能使用SQL Server,因为其中任何一个都是ASP。”NET版本2.0会话状态没有安装在SQL服务器或ASP上。NET没有运行dbo的权限。TempGetVersion存储过程。如果ASP。NET会话状态模式尚未安装,请安装ASP。NET会话状态SQL Server 2.0或以上版本。如果模式已经安装,请在dbo上授予执行权限。将TempGetVersion存储过程转换为ASP。NET应用程序池标识,或sqlConnectionString属性中指定的Sql服务器用户。

Image of the error:

形象的错误:

asp.net会话状态模式“SQLServer”

I am not able to understand the exact problem and how i can solve it. Any help will be appreciated.

我不明白确切的问题,也不知道如何解决它。如有任何帮助,我们将不胜感激。

Thank You

谢谢你!

4 个解决方案

#1


5  

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

在树中打开“可编程性”,首先检查dbo是否存在。TempGetVersion存在。可能您还没有安装正确的模式。

#2


27  

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.

我相信-ssadd选项(“增加了对SQL Server模式会话状态的支持”)是它正确设置存储过程的原因。请参见此链接以获得选项的完整列表。

#3


2  

Maybe you have a bad tag in your web.config

也许你的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"/>

#4


0  

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:

我被这个问题困住了,没有一个答案对我有效,只是为了防止其他人有这个问题,这就是解决我的问题的原因,我在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.

以防别人和我陷入同样的困境。

#1


5  

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

在树中打开“可编程性”,首先检查dbo是否存在。TempGetVersion存在。可能您还没有安装正确的模式。

#2


27  

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.

我相信-ssadd选项(“增加了对SQL Server模式会话状态的支持”)是它正确设置存储过程的原因。请参见此链接以获得选项的完整列表。

#3


2  

Maybe you have a bad tag in your web.config

也许你的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"/>

#4


0  

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:

我被这个问题困住了,没有一个答案对我有效,只是为了防止其他人有这个问题,这就是解决我的问题的原因,我在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.

以防别人和我陷入同样的困境。