Exception Setting up Microservice Project
abp.core, lastest as 24-May-2020
UI MVC
Steps to reproduce!
Build MicroserviceDemo following the instructions [https://docs.abp.io/en/abp/latest/Samples/Microservice-Demo]
Run AuthServer.Host as first project.
Check the logs:
Volo.Abp.Identity.EntityFrameworkCore.IdentityDbContext'.
Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'AbpUserOrganizationUnits'.
Failed executing DbCommand (14ms) [Parameters=[@__ef_filter__p_0='?' (DbType = Boolean), @__ef_filter__p_1='?' (DbType = Boolean), @__normalizedUserName_0='?' (Size = 256), @__ef_filter__p_3='?' (DbType = Boolean), @__ef_filter__p_5='?' (DbType = Boolean), @__ef_filter__p_7='?' (DbType = Boolean), @__ef_filter__p_9='?' (DbType = Boolean), @__ef_filter__p_11='?' (DbType = Boolean)], CommandType='"Text"', CommandTimeout='30']
SELECT [t].[Id], [t].[AccessFailedCount], [t].[ConcurrencyStamp], [t].[CreationTime], [t].[CreatorId], [t].[DeleterId], [t].[DeletionTime], [t].[Email], [t].[EmailConfirmed], [t].[ExtraProperties], [t].[IsDeleted], [t].[LastModificationTime], [t].[LastModifierId], [t].[LockoutEnabled], [t].[LockoutEnd], [t].[Name], [t].[NormalizedEmail], [t].[NormalizedUserName], [t].[PasswordHash], [t].[PhoneNumber], [t].[PhoneNumberConfirmed], [t].[SecurityStamp], [t].[Surname], [t].[TenantId], [t].[TwoFactorEnabled], [t].[UserName], [t0].[UserId], [t0].[RoleId], [t0].[TenantId], [t1].[UserId], [t1].[LoginProvider], [t1].[ProviderDisplayName], [t1].[ProviderKey], [t1].[TenantId], [t2].[Id], [t2].[ClaimType], [t2].[ClaimValue], [t2].[TenantId], [t2].[UserId], [t3].[UserId], [t3].[LoginProvider], [t3].[Name], [t3].[TenantId], [t3].[Value], [t4].[OrganizationUnitId], [t4].[UserId], [t4].[CreationTime], [t4].[CreatorId], [t4].[TenantId]
FROM (
SELECT TOP(1) [a].[Id], [a].[AccessFailedCount], [a].[ConcurrencyStamp], [a].[CreationTime], [a].[CreatorId], [a].[DeleterId], [a].[DeletionTime], [a].[Email], [a].[EmailConfirmed], [a].[ExtraProperties], [a].[IsDeleted], [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(1 AS bit))) AND ((@__ef_filter__p_1 = CAST(1 AS bit)) OR [a].[TenantId] IS NULL)) AND ([a].[NormalizedUserName] = @__normalizedUserName_0)
) AS [t]
LEFT JOIN (
SELECT [a0].[UserId], [a0].[RoleId], [a0].[TenantId]
FROM [AbpUserRoles] AS [a0]
WHERE (@__ef_filter__p_3 = CAST(1 AS bit)) OR [a0].[TenantId] IS NULL
) AS [t0] ON [t].[Id] = [t0].[UserId]
LEFT JOIN (
SELECT [a1].[UserId], [a1].[LoginProvider], [a1].[ProviderDisplayName], [a1].[ProviderKey], [a1].[TenantId]
FROM [AbpUserLogins] AS [a1]
WHERE (@__ef_filter__p_5 = CAST(1 AS bit)) OR [a1].[TenantId] IS NULL
) AS [t1] ON [t].[Id] = [t1].[UserId]
LEFT JOIN (
SELECT [a2].[Id], [a2].[ClaimType], [a2].[ClaimValue], [a2].[TenantId], [a2].[UserId]
FROM [AbpUserClaims] AS [a2]
WHERE (@__ef_filter__p_7 = CAST(1 AS bit)) OR [a2].[TenantId] IS NULL
) AS [t2] ON [t].[Id] = [t2].[UserId]
LEFT JOIN (
SELECT [a3].[UserId], [a3].[LoginProvider], [a3].[Name], [a3].[TenantId], [a3].[Value]
FROM [AbpUserTokens] AS [a3]
WHERE (@__ef_filter__p_9 = CAST(1 AS bit)) OR [a3].[TenantId] IS NULL
) AS [t3] ON [t].[Id] = [t3].[UserId]
LEFT JOIN (
SELECT [a4].[OrganizationUnitId], [a4].[UserId], [a4].[CreationTime], [a4].[CreatorId], [a4].[TenantId]
FROM [AbpUserOrganizationUnits] AS [a4]
WHERE (@__ef_filter__p_11 = CAST(1 AS bit)) OR [a4].[TenantId] IS NULL
) AS [t4] ON [t].[Id] = [t4].[UserId]
ORDER BY [t].[Id], [t0].[UserId], [t0].[RoleId], [t1].[UserId], [t1].[LoginProvider], [t2].[Id], [t3].[UserId], [t3].[LoginProvider], [t3].[Name], [t4].[OrganizationUnitId], [t4].[UserId]
2020-05-24 17:25:15.733 +05:30 [ERR] An exception occurred while iterating over the results of a query for context type 'Volo.Abp.Identity.EntityFrameworkCore.IdentityDbContext'.
Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'AbpUserOrganizationUnits'.
at Microsoft.Data.SqlClient.SqlCommand.<>c.1 result)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
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 where exception was thrown ---
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
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.QueryingEnumerable1.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.QueryingEnumerable1.AsyncEnumerator.MoveNextAsync()
ClientConnectionId:86315635-4001-41fb-876d-35c0ed991c2a
Error Number:208,State:1,Class:16
Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'AbpUserOrganizationUnits'.
at Microsoft.Data.SqlClient.SqlCommand.<>c.1 result)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
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 where exception was thrown ---
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
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.QueryingEnumerable1.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.QueryingEnumerable1.AsyncEnumerator.MoveNextAsync()
ClientConnectionId:86315635-4001-41fb-876d-35c0ed991c2a
Error Number:208,State:1,Class:16
2020-05-24 17:25:32.230 +05:30 [FTL] Application startup exception
Volo.Abp.AbpInitializationException: An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module AuthServer.Host.AuthServerHostModule, AuthServer.Host, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. See the inner exception for details.
---> Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'AbpUserOrganizationUnits'.
at Microsoft.Data.SqlClient.SqlCommand.<>c.1 result)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
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 where exception was thrown ---
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
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.QueryingEnumerable1.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.QueryingEnumerable1.AsyncEnumerator.MoveNextAsync()
at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsyncTSource
at Volo.Abp.Identity.EntityFrameworkCore.EfCoreIdentityUserRepository.FindByNormalizedUserNameAsync(String normalizedUserName, Boolean includeDetails, CancellationToken cancellationToken) in D:\FIRepo\abp-dev\modulesidentity\src\Volo.Abp.Identity.EntityFrameworkCore\Volo\Abp\Identity\EntityFrameworkCore\EfCoreIdentityUserRepository.cs:line 27
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronousTResult
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() in D:\FIRepo\abp-dev\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAbpMethodInvocationAdapterWithReturnValue.cs:line 24
at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) in D:\FIRepo\abp-dev\framework\src\Volo.Abp.Uow\Volo\Abp\Uow\UnitOfWorkInterceptor.cs:line 31
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsyncTResult in D:\FIRepo\abp-dev\modulesidentity\src\Volo.Abp.Identity.Domain\Volo\Abp\Identity\IdentityDataSeeder.cs:line 48
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronousTResult
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() in D:\FIRepo\abp-dev\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAbpMethodInvocationAdapterWithReturnValue.cs:line 24
at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) in D:\FIRepo\abp-dev\framework\src\Volo.Abp.Uow\Volo\Abp\Uow\UnitOfWorkInterceptor.cs:line 31
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsyncTResult
at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsyncTSource in D:\FIRepo\abp-dev\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAsyncAbpInterceptorAdapter.cs:line 29
at Volo.Abp.Identity.IdentityDataSeeder.SeedAsync(String adminEmail, String adminPassword, Nullable1 tenantId) in D:\FIRepo\abp-dev\modules\identity\src\Volo.Abp.Identity.Domain\Volo\Abp\Identity\IdentityDataSeeder.cs:line 48
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() in D:\FIRepo\abp-dev\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAbpMethodInvocationAdapterWithReturnValue.cs:line 24
at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) in D:\FIRepo\abp-dev\framework\src\Volo.Abp.Uow\Volo\Abp\Uow\UnitOfWorkInterceptor.cs:line 31
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) in D:\FIRepo\abp-dev\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAsyncAbpInterceptorAdapter.cs:line 29
at Volo.Abp.Data.DataSeeder.SeedAsync(DataSeedContext context) in D:\FIRepo\abp-dev\framework\src\Volo.Abp.Data\Volo\Abp\Data\DataSeeder.cs:line 34
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() in D:\FIRepo\abp-dev\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAbpMethodInvocationAdapter.cs:line 23
at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) in D:\FIRepo\abp-dev\framework\src\Volo.Abp.Uow\Volo\Abp\Uow\UnitOfWorkInterceptor.cs:line 31
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) in D:\FIRepo\abp-dev\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAsyncAbpInterceptorAdapter.cs:line 20
at AuthServer.Host.AuthServerHostModule.<>c__DisplayClass1_0.<
--- End of stack trace from previous location where exception was thrown ---
at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException(Task task)
at Nito.AsyncEx.AsyncContext.<>c__DisplayClass15_0.
at System.Threading.Tasks.ContinuationTaskFromTask.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
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 where exception was thrown ---
at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException(Task task)
at Nito.AsyncEx.AsyncContext.Run(Func1 action)
at Volo.Abp.Threading.AsyncHelper.RunSync(Func1 action) in D:\FIRepo\abp-dev\framework\src\Volo.Abp.Core\Volo\Abp\Threading\AsyncHelper.cs:line 74
at AuthServer.Host.AuthServerHostModule.OnApplicationInitialization(ApplicationInitializationContext context) in D:\FIRepo\abp-dev\samples\MicroserviceDemo\applications\AuthServer.Host\AuthServerHostModule.cs:line 108
at Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor.Initialize(ApplicationInitializationContext context, IAbpModule module) in D:\FIRepo\abp-dev\framework\src\Volo.Abp.Core\Volo\Abp\Modularity\DefaultModuleLifecycleContributor.cs:line 7
at Volo.Abp.Modularity.ModuleManager.InitializeModules(ApplicationInitializationContext context) in D:\FIRepo\abp-dev\framework\src\Volo.Abp.Core\Volo\Abp\Modularity\ModuleManager.cs:line 43
ClientConnectionId:86315635-4001-41fb-876d-35c0ed991c2a
Error Number:208,State:1,Class:16
--- End of inner exception stack trace ---
at Volo.Abp.Modularity.ModuleManager.InitializeModules(ApplicationInitializationContext context) in D:\FIRepo\abp-dev\framework\src\Volo.Abp.Core\Volo\Abp\Modularity\ModuleManager.cs:line 47
at Volo.Abp.AbpApplicationBase.InitializeModules() in D:\FIRepo\abp-dev\framework\src\Volo.Abp.Core\Volo\Abp\AbpApplicationBase.cs:line 72
at Volo.Abp.AbpApplicationWithExternalServiceProvider.Initialize(IServiceProvider serviceProvider) in D:\FIRepo\abp-dev\framework\src\Volo.Abp.Core\Volo\Abp\AbpApplicationWithExternalServiceProvider.cs:line 27
at Microsoft.AspNetCore.Builder.AbpApplicationBuilderExtensions.InitializeApplication(IApplicationBuilder app) in D:\FIRepo\abp-dev\framework\src\Volo.Abp.AspNetCore\Microsoft\AspNetCore\Builder\AbpApplicationBuilderExtensions.cs:line 38
at AuthServer.Host.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) in D:\FIRepo\abp-dev\samples\MicroserviceDemo\applications\AuthServer.Host\Startup.cs:line 19
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.
at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.
at Microsoft.AspNetCore.Server.IIS.Core.IISServerSetupFilter.<>c__DisplayClass2_0.
at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
at AuthServer.Host.Program.Main(String[] args) in D:\FIRepo\abp-dev\samples\MicroserviceDemo\applications\AuthServer.Host\Program.cs:line 43
Add migration using command line in AuthServer.Host project folder:
dotnet ef migartions Added_AbpOrganizationUnit
Then run:
dotnet ef database update
@liangshiw thanks for quick response, but i don't have this file in the project.
Screenshot below!

Am i supposed to use a specific branch?
Hi @liangshiw,
My bad, i did not realize i was supposed to generate it!
This did not work for me!
dotnet ef migrations Added_AbpOrganizationUnit
and I went ahead and used this:
dotnet ef migrations add Added_AbpOrganizationUnit
and the migration file was generated successfully!
and finally
dotnet ef database update
Created the tables in SQL!
Feels like, either we add the file in the AuthServer.Host or update the setup document.
Thank you so much for pushing in right direction!
Most helpful comment
Hi @liangshiw,
My bad, i did not realize i was supposed to generate it!
This did not work for me!
dotnet ef migrations Added_AbpOrganizationUnit
and I went ahead and used this:
dotnet ef migrations add Added_AbpOrganizationUnit
and the migration file was generated successfully!
and finally
dotnet ef database update
Created the tables in SQL!
Feels like, either we add the file in the AuthServer.Host or update the setup document.
Thank you so much for pushing in right direction!