设置错误 - 数据库中已经有一个名为 'AbpAuditLogs' 的对象
Setup Error - There is already an object named 'AbpAuditLogs' in the database
无论我下载哪种解决方案(预发布版或稳定版),我都会继续收到相同的错误。这是我遵循的步骤。
- 在 Visual Studio 社区 2017 v 15.5.3
中打开
- 构建以恢复 NuGet 包
- 将 Web 项目设置为启动项目
- 在 web.config 连接字符串中,我将 "Server=Localhost" 更改为 "Server=.\SQLExpress"
- 在包管理器控制台中 select EntityFramework 作为默认项目
- 运行更新数据库
得到以下错误:
应用显式迁移:[201707261347311_Initial_Migration、201710131316266_UpgradedTo_ABP_3.1、201801311121458_Modified_Authorization_Entities、201803261403237_Upgraded_To_Abp_v3_5、201807270535111_Updated_ABP、201807271154374_Upgraded_ABP_3.8.1] .
应用显式迁移:201707261347311_Initial_Migration。
应用显式迁移:201710131316266_UpgradedTo_ABP_3.1。
应用显式迁移:201801311121458_Modified_Authorization_Entities。
应用显式迁移:201803261403237_Upgraded_To_Abp_v3_5。
应用显式迁移:201807270535111_Updated_ABP。
System.Data.SqlClient.SqlException (0x80131904): 数据库中已经有一个名为'AbpAuditLogs' 的对象。
在 System.Data.SqlClient.SqlConnection.OnError(SqlException 异常,Boolean breakConnection,Action1 wrapCloseInAction)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action
1 wrapCloseInAction)
在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj,布尔调用程序有连接锁,布尔异步关闭)
在 System.Data.SqlClient.TdsParser.TryRun(运行Behavior runBehavior、SqlCommand cmdHandler、SqlDataReader dataStream、BulkCopySimpleResultSet bulkCopyHandler、TdsParserStateObject stateObj、Boolean& dataReady)
在 System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(字符串方法名称、布尔异步、Int32 超时、布尔异步写入)
在 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<NonQuery>b__0(DbCommand t, DbCommandInterceptionContext
1 c)
在System.Data.Entity.Infrastructure.Interception.InternalDispatcher1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func
3操作,TInterceptionContext拦截上下文,Action3 executing, Action
3执行)
在 System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.NonQuery(DbCommand 命令,DbCommandInterceptionContext 拦截上下文)
在 System.Data.Entity.Internal.InterceptableDbCommand.ExecuteNonQuery()
at System.Data.Entity.Migrations.DbMigrator.ExecuteSql(MigrationStatement migrationStatement, DbConnection 连接, DbTransaction 事务, DbInterceptionContext 拦截上下文)
at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.ExecuteSql(MigrationStatement migrationStatement, DbConnection 连接, DbTransaction 事务, DbInterceptionContext 拦截上下文)
at System.Data.Entity.Migrations.DbMigrator.ExecuteStatementsInternal(IEnumerable1 migrationStatements, DbConnection connection, DbTransaction transaction, DbInterceptionContext interceptionContext)
at System.Data.Entity.Migrations.DbMigrator.ExecuteStatementsWithinTransaction(IEnumerable
1 migrationStatements, DbTransaction 事务, DbInterceptionContext 拦截上下文)
在System.Data.Entity.Migrations.DbMigrator.ExecuteStatementsWithinNewTransaction(IEnumerable1 migrationStatements, DbConnection connection, DbInterceptionContext interceptionContext)
at System.Data.Entity.Migrations.DbMigrator.ExecuteStatementsInternal(IEnumerable
1 migrationStatements, DbConnection 连接, DbInterceptionContext interceptionContext)
在 System.Data.Entity.Migrations.DbMigrator.ExecuteStatementsInternal(IEnumerable1 migrationStatements, DbConnection connection)
at System.Data.Entity.Migrations.DbMigrator.<>c__DisplayClass32.<ExecuteStatements>b__30()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.<>c__DisplayClass1.<Execute>b__0()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func
1 操作)
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(动作操作)
在 System.Data.Entity.Migrations.DbMigrator.ExecuteStatements(IEnumerable1 migrationStatements, DbTransaction existingTransaction)
at System.Data.Entity.Migrations.DbMigrator.ExecuteStatements(IEnumerable
1 个迁移语句)
在 System.Data.Entity.Migrations.Infrastructure.MigratorBase.ExecuteStatements(IEnumerable1 migrationStatements)
at System.Data.Entity.Migrations.DbMigrator.ExecuteOperations(String migrationId, VersionedModel targetModel, IEnumerable
1 操作,IEnumerable1 systemOperations, Boolean downgrading, Boolean auto)
at System.Data.Entity.Migrations.DbMigrator.ApplyMigration(DbMigration migration, DbMigration lastMigration)
at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.ApplyMigration(DbMigration migration, DbMigration lastMigration)
at System.Data.Entity.Migrations.DbMigrator.Upgrade(IEnumerable
1 pendingMigrations,字符串 targetMigrationId,字符串 lastMigrationId)
在 System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.Upgrade(IEnumerable`1 pendingMigrations,字符串 targetMigrationId,字符串 lastMigrationId)
在 System.Data.Entity.Migrations.DbMigrator.UpdateInternal(字符串目标迁移)
在 System.Data.Entity.Migrations.DbMigrator.<>c__DisplayClasse.b__d()
在 System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(操作 mustSucceedToKeepDatabase)
在 System.Data.Entity.Migrations.Infrastructure.MigratorBase.EnsureDatabaseExists(操作 mustSucceedToKeepDatabase)
在 System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration)
在 System.Data.Entity.Migrations.Infrastructure.MigratorBase.Update(字符串目标迁移)
在 System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.RunCore()
在 System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run()
ClientConnectionId:f703c413-5ffa-4dfe-bee8-4641d26e1fce
错误 Number:2714,状态:6,Class:16
数据库中已经有一个名为 'AbpAuditLogs' 的对象。
正在创建数据库,但我认为最后一次迁移 201807270535111_Updated_ABP 导致了冲突。
您可以删除所有迁移并添加新的“Initial Migration”。
参考:https://github.com/aspnetboilerplate/module-zero-template/pull/140
无论我下载哪种解决方案(预发布版或稳定版),我都会继续收到相同的错误。这是我遵循的步骤。
- 在 Visual Studio 社区 2017 v 15.5.3 中打开
- 构建以恢复 NuGet 包
- 将 Web 项目设置为启动项目
- 在 web.config 连接字符串中,我将 "Server=Localhost" 更改为 "Server=.\SQLExpress"
- 在包管理器控制台中 select EntityFramework 作为默认项目
- 运行更新数据库
得到以下错误:
应用显式迁移:[201707261347311_Initial_Migration、201710131316266_UpgradedTo_ABP_3.1、201801311121458_Modified_Authorization_Entities、201803261403237_Upgraded_To_Abp_v3_5、201807270535111_Updated_ABP、201807271154374_Upgraded_ABP_3.8.1] .
应用显式迁移:201707261347311_Initial_Migration。
应用显式迁移:201710131316266_UpgradedTo_ABP_3.1。
应用显式迁移:201801311121458_Modified_Authorization_Entities。
应用显式迁移:201803261403237_Upgraded_To_Abp_v3_5。
应用显式迁移:201807270535111_Updated_ABP。
System.Data.SqlClient.SqlException (0x80131904): 数据库中已经有一个名为'AbpAuditLogs' 的对象。
在 System.Data.SqlClient.SqlConnection.OnError(SqlException 异常,Boolean breakConnection,Action1 wrapCloseInAction)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action
1 wrapCloseInAction)
在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj,布尔调用程序有连接锁,布尔异步关闭)
在 System.Data.SqlClient.TdsParser.TryRun(运行Behavior runBehavior、SqlCommand cmdHandler、SqlDataReader dataStream、BulkCopySimpleResultSet bulkCopyHandler、TdsParserStateObject stateObj、Boolean& dataReady)
在 System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(字符串方法名称、布尔异步、Int32 超时、布尔异步写入)
在 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<NonQuery>b__0(DbCommand t, DbCommandInterceptionContext
1 c)
在System.Data.Entity.Infrastructure.Interception.InternalDispatcher1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func
3操作,TInterceptionContext拦截上下文,Action3 executing, Action
3执行)
在 System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.NonQuery(DbCommand 命令,DbCommandInterceptionContext 拦截上下文)
在 System.Data.Entity.Internal.InterceptableDbCommand.ExecuteNonQuery()
at System.Data.Entity.Migrations.DbMigrator.ExecuteSql(MigrationStatement migrationStatement, DbConnection 连接, DbTransaction 事务, DbInterceptionContext 拦截上下文)
at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.ExecuteSql(MigrationStatement migrationStatement, DbConnection 连接, DbTransaction 事务, DbInterceptionContext 拦截上下文)
at System.Data.Entity.Migrations.DbMigrator.ExecuteStatementsInternal(IEnumerable1 migrationStatements, DbConnection connection, DbTransaction transaction, DbInterceptionContext interceptionContext)
at System.Data.Entity.Migrations.DbMigrator.ExecuteStatementsWithinTransaction(IEnumerable
1 migrationStatements, DbTransaction 事务, DbInterceptionContext 拦截上下文)
在System.Data.Entity.Migrations.DbMigrator.ExecuteStatementsWithinNewTransaction(IEnumerable1 migrationStatements, DbConnection connection, DbInterceptionContext interceptionContext)
at System.Data.Entity.Migrations.DbMigrator.ExecuteStatementsInternal(IEnumerable
1 migrationStatements, DbConnection 连接, DbInterceptionContext interceptionContext)
在 System.Data.Entity.Migrations.DbMigrator.ExecuteStatementsInternal(IEnumerable1 migrationStatements, DbConnection connection)
at System.Data.Entity.Migrations.DbMigrator.<>c__DisplayClass32.<ExecuteStatements>b__30()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.<>c__DisplayClass1.<Execute>b__0()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func
1 操作)
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(动作操作)
在 System.Data.Entity.Migrations.DbMigrator.ExecuteStatements(IEnumerable1 migrationStatements, DbTransaction existingTransaction)
at System.Data.Entity.Migrations.DbMigrator.ExecuteStatements(IEnumerable
1 个迁移语句)
在 System.Data.Entity.Migrations.Infrastructure.MigratorBase.ExecuteStatements(IEnumerable1 migrationStatements)
at System.Data.Entity.Migrations.DbMigrator.ExecuteOperations(String migrationId, VersionedModel targetModel, IEnumerable
1 操作,IEnumerable1 systemOperations, Boolean downgrading, Boolean auto)
at System.Data.Entity.Migrations.DbMigrator.ApplyMigration(DbMigration migration, DbMigration lastMigration)
at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.ApplyMigration(DbMigration migration, DbMigration lastMigration)
at System.Data.Entity.Migrations.DbMigrator.Upgrade(IEnumerable
1 pendingMigrations,字符串 targetMigrationId,字符串 lastMigrationId)
在 System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.Upgrade(IEnumerable`1 pendingMigrations,字符串 targetMigrationId,字符串 lastMigrationId)
在 System.Data.Entity.Migrations.DbMigrator.UpdateInternal(字符串目标迁移)
在 System.Data.Entity.Migrations.DbMigrator.<>c__DisplayClasse.b__d()
在 System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(操作 mustSucceedToKeepDatabase)
在 System.Data.Entity.Migrations.Infrastructure.MigratorBase.EnsureDatabaseExists(操作 mustSucceedToKeepDatabase)
在 System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration)
在 System.Data.Entity.Migrations.Infrastructure.MigratorBase.Update(字符串目标迁移)
在 System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.RunCore()
在 System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run()
ClientConnectionId:f703c413-5ffa-4dfe-bee8-4641d26e1fce
错误 Number:2714,状态:6,Class:16
数据库中已经有一个名为 'AbpAuditLogs' 的对象。
正在创建数据库,但我认为最后一次迁移 201807270535111_Updated_ABP 导致了冲突。
您可以删除所有迁移并添加新的“Initial Migration”。
参考:https://github.com/aspnetboilerplate/module-zero-template/pull/140