2012-02-21 115 views
1

我想在共享虚拟主机上的SQL Server 2008中存储会话。我现在做了,直到为:在共享虚拟主机上在SQL Server中存储会话

  1. 运行“InstallPersistSqlState.sql”对数据库
  2. 在命令行我做了这个脚本:aspnet_regsql -ssadd -sstype c -d SessionDb -sqlexportonly c:\SessionScript.sql(使用aspnet_regsq.exe)
  3. 运行SessionScript.sql对数据库。

创建了两个表(ASPStateTempApplicationsASPStateTempSessions)以及所有必需的存储过程。

web.config文件看起来像这样:试图运行网站的时候终于

<sessionState 
      mode="SQLServer" 
      allowCustomSqlDatabase="true" 
      sqlConnectionString="server;Initial Catalog=db;User ID=usr;Password=pwd" 
      cookieless="false" timeout="20" /> 

我一收到此错误:

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.

我查了无处不在互联网上,但没有找到任何解决方案,可以帮助我解决这个问题。

回答

1

您需要联系网络主机 - 他们将需要为您安装ASPState(但我敢打赌他们不会这样做)。您可能不得不使用InProc或其他解决方案。你有多个Web服务器,或只有一个?

+0

我只有一个,但不知何故会话是每隔几个小时回收。 – baaroz 2012-02-21 16:29:23

+0

你也需要和你的网络主机谈谈。 – 2012-02-21 16:29:54