title: aspnet_regsql problem with creating Session tables in mssql
body: <p>I'am using session state handling in ASP.NET by MSSQL server with:</p>
  
  <pre><code>sessionState mode="SQLServer"
  </code></pre>
  
  <p>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 (<em>*</em> - are masked data):</p>
  
  <pre><code>        C:\Windows\Microsoft.NET\Framework\v4.0.30319&gt;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)
  </code></pre>
  
  <p>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 ?! </p>
  
  <p>Best regards</p>