我正在使用MSSQL服务器在ASP.NET中使用会话状态处理:
sessionState mode="SQLServer"
web.config中的。本地我使用aspnet_regsql没有问题但是在尝试在生产服务器上执行相同操作时它会抛出异常( * - 是屏蔽数据):
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regsql.exe -S somehostserver.com -U _admin -P _password -ssadd -sstype c -d mydb
Start adding session state.
.
An error occurred during the execution of the SQL file 'InstallSqlState.sql'. Th
e SQL error number is 229 and the SqlException message is: The EXECUTE permissio
n was denied on the object 'sp_delete_job', database 'msdb', schema 'dbo'.
If the job does not exist, an error from msdb.dbo.sp_delete_job is expected.
SQL Server: *
Database: [*]
SQL file loaded:
InstallSqlState.sql
Commands failed:
/* Drop all tables, startup procedures, stored procedures and types. */
/* Drop the DeleteExpiredSessions_Job */
DECLARE @jobname nvarchar(200)
SET @jobname = N'***' + '_Job_DeleteExpiredSessions'
-- Delete the [local] job
-- We expected to get an error if the job doesn't exist.
PRINT 'If the job does not exist, an error from msdb.dbo.sp_delete_job is expect
ed.'
EXECUTE msdb.dbo.sp_delete_job @job_name = @jobname
SQL Exception:
System.Data.SqlClient.SqlException (0x80131904): The EXECUTE permission was deni
ed on the object 'sp_delete_job', database 'msdb', schema 'dbo'.
If the job does not exist, an error from msdb.dbo.sp_delete_job is expected.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolea
n breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception
, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cm
dHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, Tds
ParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName,
Boolean async)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult res
ult, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at System.Web.Management.SqlServices.ExecuteFile(String file, String server,
String database, String dbFileName, SqlConnection connection, Boolean sessionSta
te, Boolean isInstall, SessionStateType sessionStatetype)
使用SQL脚本会导致类似的错误。我该怎么办 ?!托管所有者建议“在您的机器上进行备份并将其置于生产中”,但这会导致另一个问题...... 有什么建议 !?或者Iam被迫手工制作桌子和程序的所有脚本?
祝你好运
答案 0 :(得分:1)
似乎用户在Master和MSDB系统数据库中缺少“RSExecRole
”角色。 Reporting Services使用名为“RSExecRole
”的预定义数据库角色向报表服务器数据库授予报表服务器权限。
使用报表服务器数据库自动创建“RSExecRole
”角色。但是,将报表服务器数据库移动到新的或不同的SQL Server Database Engine
时,必须在Master和MSDB系统数据库中重新创建该角色。
以下是如何创建“RSExecRole”的链接参考: