3

I'am using session state handling in ASP.NET by MSSQL server with:

sessionState mode="SQLServer"

in web.config. Locally I used aspnet_regsql with no problems but while trying to do same on production server it throws exception at me (* - are masked data):

        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)

Using SQL scripts causes similar errors. What should I do ?! Hosting owner suggests "make backup on ur machine and place it in production", but This causes another problems... Any suggestions !? Or Iam forced to craft by hand all scripts for tables and procedures ?!

Best regards

1 Answer 1

1

It seems that the user is missing the "RSExecRole" role in the Master and MSDB system databases. Reporting Services uses a predefined database role called "RSExecRole" to grant report server permissions to the report server database.

The "RSExecRole" role is created automatically with the report server database. However, when you move a report server database to a new or different SQL Server Database Engine, must re-create the role in the Master and MSDB system databases.

Here is a link reference to how to create the "RSExecRole":

http://technet.microsoft.com/en-us/library/cc281308.aspx

Sign up to request clarification or add additional context in comments.

2 Comments

I will check out your suggestion, but I wonder what "Reporting services" got to do with sessions set up by aspnet_regsql
This does solve the problem and should be marked as solved

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.