I am trying to configure a mssql private sessionState database. I added the following to web.config's :
<sessionState mode="Custom" customProvider="mssql" cookieless="false" timeout="20">
<providers>
<add name="mssql" type="Sitecore.SessionProvider.Sql.SqlSessionStateProvider, Sitecore.SessionProvider.Sql" connectionStringName="session" pollingInterval="2" compression="true" sessionType="private"/>
</providers>
</sessionState>
My connection string (with password and domain altered for security):
<add name="session"
connectionString="user id=Sitecore;password=mypassword;Data Source=db.mydomain.com;Database=Sitecore_Sessions;Initial Catalog=Sitecore_Sessions"/>
However, this throws an error at runtime rendering the site useless:
Event code: 3008 Event message: A configuration error has occurred. Event time: 9/27/2016 1:27:20 PM Event time (UTC): 9/27/2016 8:27:20 PM Event ID: 9b328571e1994ddf8f99ae0ad4d56473 Event sequence: 8 Event occurrence: 1 Event detail code: 0 Application information: Application domain: /LM/W3SVC/1/ROOT-1-131194816187533180 Trust level: Full Application Virtual Path: / Application Path: E:\wwwroot\Sitecore\Website\ Process information: Process ID: 9180 Process name: w3wp.exe Account name: IIS APPPOOL\SitecoreAppPool Exception information: Exception type: ConfigurationErrorsException Exception message: The SELECT permission was denied on the object 'Application', database 'tempdb', schema 'dbo'. The SELECT permission was denied on the object 'Application', database 'tempdb', schema 'dbo'. The INSERT permission was denied on the object 'Application', database 'tempdb', schema 'dbo'. (E:\wwwroot\Sitecore\Website\web.config line 371) at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType) at System.Web.SessionState.SessionStateModule.SecureInstantiateProvider(ProviderSettings settings) at System.Web.SessionState.SessionStateModule.InitModuleFromConfig(HttpApplication app, SessionStateSection config) at System.Web.SessionState.SessionStateModule.Init(HttpApplication app)
at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) at System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)The SELECT permission was denied on the object 'Application', database 'tempdb', schema 'dbo'. The SELECT permission was denied on the object 'Application', database 'tempdb', schema 'dbo'. The INSERT permission was denied on the object 'Application', database 'tempdb', schema 'dbo'. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action
1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds, Boolean describeParameterEncryptionRequest) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource
1 completion, Int32 timeout, Task& task, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Sitecore.SessionProvider.Sql.SqlSessionStateStore.GetApplicationIdentifier(String name) at Sitecore.SessionProvider.Sql.SqlSessionStateProvider.Initialize(String name, NameValueCollection config) at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType)Request information: Request URL: http://localhost/ Request path: / User host address: 127.0.0.1 User: Is authenticated: False Authentication Type: Thread account name: IIS APPPOOL\SitecoreAppPool Thread information: Thread ID: 9 Thread account name: IIS APPPOOL\SitecoreAppPool Is impersonating: False Stack trace: at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings
providerSettings, Type providerType) at System.Web.SessionState.SessionStateModule.SecureInstantiateProvider(ProviderSettings settings) at System.Web.SessionState.SessionStateModule.InitModuleFromConfig(HttpApplication app, SessionStateSection config) at System.Web.SessionState.SessionStateModule.Init(HttpApplication app)
at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) at System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)
It appears that this could be is a permissions issue, but wouldn't permissions get reset on the tempdb every time the SQL server is rebooted?
I am running Sitecore 8.1
UPDATE: I can duplicate this behavior in SQL Management studio.
USE [Sitecore_sessions]
SELECT * FROM [dbo].[Applications]
Returns the following error:
Msg 229, Level 14, State 5, Line 2 The SELECT permission was denied on the object 'Application', database 'tempdb', schema 'dbo'.
That is because dbo.Applications is a synonym that points to tempdb. :-(
dbo.Application
.