本机环境 .net5.0
使用sqlserver 2012 生成种子
dotnet WQLIdentityServerAPI.dll seed 报错
info: Microsoft.EntityFrameworkCore.Infrastructure[10403] Entity Framework Core 5.0.3 initialized 'ApplicationDbContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: None Security Warning: The negotiated TLS 1.0 is an insecure protocol and is supported for backward compatibility only. The recommended protocol version is TLS 1.2 and later. fail: Microsoft.EntityFrameworkCore.Database.Command[20102] Failed executing DbCommand (59ms) [Parameters=[@__normalizedName_0='?' (Size = 256)], CommandType='Text', CommandTimeout='30'] SELECT TOP(1) [a].[Id], [a].[ConcurrencyStamp], [a].[CreatedOn], [a].[Name], [a].[NormalizedName] FROM [AspNetRoles] AS [a] WHERE [a].[NormalizedName] = @__normalizedName_0 fail: Microsoft.EntityFrameworkCore.Query[10100] An exception occurred while iterating over the results of a query for context type 'WQLIdentity.Infra.Data.ApplicationDbContext'. Microsoft.Data.SqlClient.SqlException (0x80131904): 对象名 'AspNetRoles' 无效。 at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__169_0(Task1 result)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke() at System.Threading.Tasks.Task.<>c.<.cctor>b__277_0(Object obj) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func4 verifySucceeded, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.AsyncEnumerator.MoveNextAsync() ClientConnectionId:8d1caab8-b8c6-4fdc-a277-b9f9a4a17e09 Error Number:208,State:1,Class:16 Microsoft.Data.SqlClient.SqlException (0x80131904): 对象名 'AspNetRoles' 无效。 at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__169_0(Task1 result)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke() at System.Threading.Tasks.Task.<>c.<.cctor>b__277_0(Object obj) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func4 verifySucceeded, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.AsyncEnumerator.MoveNextAsync() ClientConnectionId:8d1caab8-b8c6-4fdc-a277-b9f9a4a17e09 Error Number:208,State:1,Class:16
另外数据迁移有错误,按最后版本应该为
`server 默认项目选择(WQLIdentity.Infra.Data)
Add-Migration InitialCreate -Context CustomConfigurationDbContext -OutputDir Migrations\Configuration\SqlServer
Add-Migration InitialCreate -Context CustomPersistedGrantDbContext -OutputDir Migrations\PersistedGrant\SqlServer
Add-Migration InitialCreate -Context ApplicationDbContext -OutputDir Migrations\Application\SqlServer
#mysql 默认项目选择(WQLIdentity.Infra.Data.Mysql)
Add-Migration InitialCreate -Context MysqlConfigurationDbContext -OutputDir Migrations\Configuration\Mysql
Add-Migration InitialCreate -Context MysqlPersistedGrantDbContext -OutputDir Migrations\PersistedGrant\Mysql
Add-Migration InitialCreate -Context MysqlApplicationDbContext -OutputDir Migrations\Application\Mysql
#sqlserver
update-database -context CustomConfigurationDbContext
update-database -context CustomPersistedGrantDbContext
update-database -context ApplicationDbContext
#mysql
update-database -context MysqlConfigurationDbContext
update-database -context MysqlPersistedGrantDbContext
update-database -context MysqlApplicationDbContext`
本机环境 .net5.0
使用sqlserver 2012 生成种子
dotnet WQLIdentityServerAPI.dll seed 报错
info: Microsoft.EntityFrameworkCore.Infrastructure[10403] Entity Framework Core 5.0.3 initialized 'ApplicationDbContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: None Security Warning: The negotiated TLS 1.0 is an insecure protocol and is supported for backward compatibility only. The recommended protocol version is TLS 1.2 and later. fail: Microsoft.EntityFrameworkCore.Database.Command[20102] Failed executing DbCommand (59ms) [Parameters=[@__normalizedName_0='?' (Size = 256)], CommandType='Text', CommandTimeout='30'] SELECT TOP(1) [a].[Id], [a].[ConcurrencyStamp], [a].[CreatedOn], [a].[Name], [a].[NormalizedName] FROM [AspNetRoles] AS [a] WHERE [a].[NormalizedName] = @__normalizedName_0 fail: Microsoft.EntityFrameworkCore.Query[10100] An exception occurred while iterating over the results of a query for context type 'WQLIdentity.Infra.Data.ApplicationDbContext'. Microsoft.Data.SqlClient.SqlException (0x80131904): 对象名 'AspNetRoles' 无效。 at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__169_0(Task1 result)at System.Threading.Tasks.ContinuationResultTaskFromResultTask
2.InnerInvoke() at System.Threading.Tasks.Task.<>c.<.cctor>b__277_0(Object obj) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken cancellationToken)at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func
4 operation, Func4 verifySucceeded, CancellationToken cancellationToken)at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable
1.AsyncEnumerator.MoveNextAsync() ClientConnectionId:8d1caab8-b8c6-4fdc-a277-b9f9a4a17e09 Error Number:208,State:1,Class:16 Microsoft.Data.SqlClient.SqlException (0x80131904): 对象名 'AspNetRoles' 无效。 at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__169_0(Task1 result)at System.Threading.Tasks.ContinuationResultTaskFromResultTask
2.InnerInvoke() at System.Threading.Tasks.Task.<>c.<.cctor>b__277_0(Object obj) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken cancellationToken)at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func
4 operation, Func4 verifySucceeded, CancellationToken cancellationToken)at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable
1.AsyncEnumerator.MoveNextAsync() ClientConnectionId:8d1caab8-b8c6-4fdc-a277-b9f9a4a17e09 Error Number:208,State:1,Class:16另外数据迁移有错误,按最后版本应该为
`server 默认项目选择(WQLIdentity.Infra.Data)
Add-Migration InitialCreate -Context CustomConfigurationDbContext -OutputDir Migrations\Configuration\SqlServer
Add-Migration InitialCreate -Context CustomPersistedGrantDbContext -OutputDir Migrations\PersistedGrant\SqlServer
Add-Migration InitialCreate -Context ApplicationDbContext -OutputDir Migrations\Application\SqlServer
#mysql 默认项目选择(WQLIdentity.Infra.Data.Mysql)
Add-Migration InitialCreate -Context MysqlConfigurationDbContext -OutputDir Migrations\Configuration\Mysql
Add-Migration InitialCreate -Context MysqlPersistedGrantDbContext -OutputDir Migrations\PersistedGrant\Mysql
Add-Migration InitialCreate -Context MysqlApplicationDbContext -OutputDir Migrations\Application\Mysql
#sqlserver
update-database -context CustomConfigurationDbContext
update-database -context CustomPersistedGrantDbContext
update-database -context ApplicationDbContext
#mysql
update-database -context MysqlConfigurationDbContext
update-database -context MysqlPersistedGrantDbContext
update-database -context MysqlApplicationDbContext`