- ABP Framework version: v5.1.4
- UI type: Angular
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): yes
- Exception message and stack trace:https://aztutehealth-my.sharepoint.com/:t:/g/personal/chitra_aztute_com/EQ7KofEDvsRDksVInhZZTLgB34KYPfimDMSJu2jQmtoGYw
- Steps to reproduce the issue:"
- download latest abp application 5.1.4
- setup 2 db
- 1st with default connection for application
- 2nd with AbpIdentity for identity server
- in DBMigrator set both connection strings
- run dbmigrator
- Wola. you got the error
24 Answer(s)
-
0
run dbmigrator
How do you run it?
Can you try to use
dotnet run
? -
0
i am using windows 11 with visual studio 2022. i use the above command also but same result
-
0
Can I check?
https://zoom.us/j/98800628842?pwd=RzlYV0tzU2NqVEZJWFBRVURUVUgwdz09
-
0
sure
-
0
hi
See https://docs.abp.io/en/abp/latest/Entity-Framework-Core-Migrations#create-a-second-dbcontext
-
0
Hello Maliming, after following all instructions, my inputs are:
- identity tables not created in business tables
- identity tables not created in identity db
- still getting same error
not sure what else i am missing
-
0
Hello Maliming, i realized my dbmgiration initial class was missing the table creation. something missing. anyway i copied the db migration manually in migration class. now i am getting this error:
Microsoft.Data.SqlClient.SqlException HResult=0x80131904 Message=Invalid object name 'IdentityServerIdentityResources'. Source=Core Microsoft SqlClient Data Provider StackTrace: at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__188_0(Task
1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask
2.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) -
0
hi
Please create a new project and send it to me, I will write some code for you. liming.ma@volosoft.com
abp new QA -t app-pro --separate-tenant-schema
-
0
fixed this. but getting another issue with error message Invalid object name "IdentityServerIdentityResources"
-
0
Invalid object name "IdentityServerIdentityResources"
Full error logs?
-
0
https://aztutehealth-my.sharepoint.com/:t:/g/personal/shobhit_aztute_com/EQfUhDgW76BMgJd6QHUpEVoB3zfq3OXubrj3dpoFQhJB8Q
-
0
tables has been created in respective databases but data seed is failing
-
0
https://support.abp.io/QA/Questions/2680#answer-66c50306-894d-cb9f-6ca2-3a02758a3d5a
-
0
email sent with generated code
-
0
Thanks Maliming. Please confirm if changes are only in *.EntityFrameoworkCore project only. You have also provided 3 commands. how exactly i should run them
-
0
if changes are only in *.EntityFrameoworkCore project only
Yes,
You have also provided 3 commands. how exactly i should run them
Run it on EntityFrameoworkCore project folder to add init migrations.
-
0
[16:43:07 ERR] Failed executing DbCommand (246ms) [Parameters=[@__ef_filter__p_0='?' (DbType = Boolean), @__ef_filter__p_1='?' (DbType = Boolean), @__normalizedUserName_0='?' (Size = 256)], CommandType='Text', CommandTimeout='30'] SELECT TOP(1) [a].[Id], [a].[AccessFailedCount], [a].[ConcurrencyStamp], [a].[CreationTime], [a].[CreatorId], [a].[DeleterId], [a].[DeletionTime], [a].[Email], [a].[EmailConfirmed], [a].[ExtraProperties], [a].[IsActive], [a].[IsDeleted], [a].[IsExternal], [a].[LastModificationTime], [a].[LastModifierId], [a].[LockoutEnabled], [a].[LockoutEnd], [a].[Name], [a].[NormalizedEmail], [a].[NormalizedUserName], [a].[PasswordHash], [a].[PhoneNumber], [a].[PhoneNumberConfirmed], [a].[SecurityStamp], [a].[Surname], [a].[TenantId], [a].[TwoFactorEnabled], [a].[UserName] FROM [AbpUsers] AS [a] WHERE (((@__ef_filter__p_0 = CAST(1 AS bit)) OR ([a].[IsDeleted] = CAST(0 AS bit))) AND ((@__ef_filter__p_1 = CAST(1 AS bit)) OR [a].[TenantId] IS NULL)) AND ([a].[NormalizedUserName] = @__normalizedUserName_0) ORDER BY [a].[Id] [16:43:07 ERR] An exception occurred while iterating over the results of a query for context type 'Volo.Abp.Identity.EntityFrameworkCore.IdentityProDbContext'. Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'AbpUsers'. at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__188_0(Task
1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask
2.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- 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.SplitQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, 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.SplitQueryingEnumerable
1.AsyncEnumerator.MoveNextAsync() ClientConnectionId:1ccd7bca-c260-4896-8868-4f8c3a9f03f7 Error Number:208,State:1,Class:16 -
0
in EntitytFrameworkCore --> onModelCreating() i have commented out
//builder.ConfigureIdentityPro(); //builder.ConfigureIdentityServer();
while you have commented only //builder.ConfigureIdentityPro();
is this problem?
-
0
Yes, If you commented out the
IdentityServer
You need to recreate all migrations for the host and tenant and IdentityServer+identity.
dotnet ef migrations add Initial --context QADbContext dotnet ef migrations add Initial --context QATenantDbContext --output-dir Migrations/Tenant dotnet ef migrations add Initial --context QAIdentityDbContext --output-dir Migrations/Identity
-
0
Run all 3 above commands but still got the error: [16:57:16 ERR] Failed executing DbCommand (261ms) [Parameters=[@__ef_filter__p_0='?' (DbType = Boolean), @__ef_filter__p_1='?' (DbType = Boolean), @__normalizedUserName_0='?' (Size = 256)], CommandType='Text', CommandTimeout='30'] SELECT TOP(1) [a].[Id], [a].[AccessFailedCount], [a].[ConcurrencyStamp], [a].[CreationTime], [a].[CreatorId], [a].[DeleterId], [a].[DeletionTime], [a].[Email], [a].[EmailConfirmed], [a].[ExtraProperties], [a].[IsActive], [a].[IsDeleted], [a].[IsExternal], [a].[LastModificationTime], [a].[LastModifierId], [a].[LockoutEnabled], [a].[LockoutEnd], [a].[Name], [a].[NormalizedEmail], [a].[NormalizedUserName], [a].[PasswordHash], [a].[PhoneNumber], [a].[PhoneNumberConfirmed], [a].[SecurityStamp], [a].[Surname], [a].[TenantId], [a].[TwoFactorEnabled], [a].[UserName] FROM [AbpUsers] AS [a] WHERE (((@__ef_filter__p_0 = CAST(1 AS bit)) OR ([a].[IsDeleted] = CAST(0 AS bit))) AND ((@__ef_filter__p_1 = CAST(1 AS bit)) OR [a].[TenantId] IS NULL)) AND ([a].[NormalizedUserName] = @__normalizedUserName_0) ORDER BY [a].[Id] [16:57:16 ERR] An exception occurred while iterating over the results of a query for context type 'Volo.Abp.Identity.EntityFrameworkCore.IdentityProDbContext'. Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'AbpUsers'. at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__188_0(Task
1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask
2.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) -
0
Full log: [17:09:14 ERR] Failed executing DbCommand (264ms) [Parameters=[@__ef_filter__p_0='?' (DbType = Boolean), @__ef_filter__p_1='?' (DbType = Boolean), @__normalizedUserName_0='?' (Size = 256)], CommandType='Text', CommandTimeout='30'] SELECT TOP(1) [a].[Id], [a].[AccessFailedCount], [a].[ConcurrencyStamp], [a].[CreationTime], [a].[CreatorId], [a].[DeleterId], [a].[DeletionTime], [a].[Email], [a].[EmailConfirmed], [a].[ExtraProperties], [a].[IsActive], [a].[IsDeleted], [a].[IsExternal], [a].[LastModificationTime], [a].[LastModifierId], [a].[LockoutEnabled], [a].[LockoutEnd], [a].[Name], [a].[NormalizedEmail], [a].[NormalizedUserName], [a].[PasswordHash], [a].[PhoneNumber], [a].[PhoneNumberConfirmed], [a].[SecurityStamp], [a].[Surname], [a].[TenantId], [a].[TwoFactorEnabled], [a].[UserName] FROM [AbpUsers] AS [a] WHERE (((@__ef_filter__p_0 = CAST(1 AS bit)) OR ([a].[IsDeleted] = CAST(0 AS bit))) AND ((@__ef_filter__p_1 = CAST(1 AS bit)) OR [a].[TenantId] IS NULL)) AND ([a].[NormalizedUserName] = @__normalizedUserName_0) ORDER BY [a].[Id] [17:09:14 ERR] An exception occurred while iterating over the results of a query for context type 'Volo.Abp.Identity.EntityFrameworkCore.IdentityProDbContext'. Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'AbpUsers'. at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__188_0(Task
1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask
2.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- 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.SplitQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, 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.SplitQueryingEnumerable
1.AsyncEnumerator.MoveNextAsync() ClientConnectionId:44e01202-8f07-4399-bf02-561dd2ae6ef5 Error Number:208,State:1,Class:16 Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'AbpUsers'. at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__188_0(Task1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask
2.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- 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.SplitQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, 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.SplitQueryingEnumerable
1.AsyncEnumerator.MoveNextAsync() at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable1 asyncEnumerable, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable
1 asyncEnumerable, CancellationToken cancellationToken) at Volo.Abp.Identity.EntityFrameworkCore.EfCoreIdentityUserRepository.FindByNormalizedUserNameAsync(String normalizedUserName, Boolean includeDetails, CancellationToken cancellationToken) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter
1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.Identity.IdentityDataSeeder.SeedAsync(String adminEmail, String adminPassword, Nullable
1 tenantId) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter
1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed) at Volo.Abp.Data.DataSeeder.SeedAsync(DataSeedContext context) ClientConnectionId:44e01202-8f07-4399-bf02-561dd2ae6ef5 Error Number:208,State:1,Class:16 -
0
Hello maliming, I am changing my question here. I am simple looking for this aspect:
- Host should have host related database tables
- Tenant should have tenant related database tables
- There should be 3rd database tables which can be shared between host and tenant
when i am looking documentation, i am realizing making identity as separate database will not be a right idea. Please correct me. if i was wrong then help me on below point.
Now when i look all modules, please help me to identity what all default modules should be on which database i.e. host and tenant
builder.ConfigurePermissionManagement();//both builder.ConfigureSettingManagement();//both builder.ConfigureBackgroundJobs(); //both builder.ConfigureAuditLogging(); //both builder.ConfigureIdentityPro(); //both builder.ConfigureIdentityServer(); //both, builder.ConfigureFeatureManagement(); //host builder.ConfigureLanguageManagement(); //both builder.ConfigureSaas(); //host builder.ConfigureTextTemplateManagement(); //both builder.ConfigureBlobStoring(); //both builder.ConfigureCmsKit(); //both builder.ConfigureCmsKitPro(); //both
-
0
There should be 3rd database tables which can be shared between host and tenant
This is wrong.
IsTenantOnlyDatabase(): Returns true if you should only create tenant-related tables, but should not create host-related tables. It is equivalent of checking modelBuilder.GetMultiTenancySide() == MultiTenancySides.Tenant.
https://docs.abp.io/en/abp/5.1/Entity-Framework-Core-Migrations#separating-host-tenant-database-schemas
-
0
Thanks Maliming.