Reputation: 5431
I have asp.net app and I'm going to store my session in SQL Server. I'm using Amazon RDS (Microsoft SQL Server Express Edition). I am using local db for testing and its works well there.
So I've tried to create session db with next line
aspnet_regsql.exe -ssadd -sstype p -S mydb.rds.amazonaws.com -U myuser-P mypass
So as I meant it works for local db. But for Amazon RDS I've received next exception:
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: mydb.rds.amazonaws.com Database: aspnetdb 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'ASPState' + '_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.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)
Does anybody know a way to solve this? This creates a database, but it is incomplete.
Upvotes: 1
Views: 5607
Reputation: 36
I've solved my issue create session DB on Amazon RDS.
Upvotes: 2
Reputation: 3955
You can use sql server session state on SQL RDS.
You just need to comment out the parts of the InstallSqlState.sql that have to do with creating SQL Server Agent jobs. The script is used when running the aspnet_regsql.exe command. It's located in the framework folder right next to that exe. It doesn't gracefully handle failing to create the jobs, so it doesn't do any of the other steps to install session state.
Here's what my InstallSqlState.sql ultimately looked like: http://pastebin.com/QJDXC093
Or alternately, you can run the aspnet_regsql.exe command on a database where you do have permissions to create jobs and then use the import/export feature in management studio to move the resulting database schema from your database to RDS.
Upvotes: 2