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
>
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?
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.
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.
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?