SaaS CMS has officially launched! Learn more now.

Session Error On IIS First Load (11.8.2)

Vote:
 

We have enabled sessions as we need them in our site, I am using Stackify Prefix and I've noticed on the first load after a local IIS reset (version 10) 2 errors are being thrown.

System.Data.SqlClient.SqlException: There is already an object named 'Sessions' in the database.
  at System.Data.SqlClient.SqlConnection.OnError
  at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning
  at System.Data.SqlClient.TdsParser.TryRun
  at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds
  at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds
  at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery
  at System.Data.SqlClient.SqlCommand.ExecuteNonQuery
  at System.Data.SqlClient.SqlCommand.ExecuteNonQuery
  at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch
  at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.NonQuery
  at System.Data.Entity.Core.Objects.ObjectContext.ExecuteStoreCommandInternal
  at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction
  at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction
  at <>c__DisplayClass59.b__57
  at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute
  at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute
  at System.Web.Providers.ModelHelper.ExecuteSql
System.Data.SqlClient.SqlException: The operation failed because an index or statistics with name 'IX_Sessions_Expires' already exists on table 'Sessions'.
  at System.Data.SqlClient.SqlConnection.OnError
  at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning
  at System.Data.SqlClient.TdsParser.TryRun
  at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds
  at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds
  at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery
  at System.Data.SqlClient.SqlCommand.ExecuteNonQuery
  at System.Data.SqlClient.SqlCommand.ExecuteNonQuery
  at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch
  at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.NonQuery
  at System.Data.Entity.Core.Objects.ObjectContext.ExecuteStoreCommandInternal
  at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction
  at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction
  at <>c__DisplayClass59.b__57
  at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute
  at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute
  at System.Web.Providers.ModelHelper.ExecuteSql


This is using the standard Episerver session config on the https://world.episerver.com/digital-experience-cloud-service/development-considerations/session-state/.

Does anyone know why this is, I know there's an underlying but in entity framework when using initalization config migrations, is this related to that?

#194681
Jun 28, 2018 9:51
Vote:
 

I do not think this is realted to EPiServer but probably to EntityFramework as you are suspecting as well. But please update thread here anyway if you find the cause so others can learn from your findings.

#194726
Jun 29, 2018 5:22
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.