Base solution for your next web application
Open Closed

TenantAppService fails to Create Tenant. Error occurs while trying to save Admin User #8091


User avatar
0
johntui created

Line of code from TenantManager.cs

                CheckErrors(await _userManager.CreateAsync(adminUser));
                await _unitOfWorkManager.Current.SaveChangesAsync(); //To get admin user's id

Error from auditlog: "System.InvalidOperationException: Sequence contains no matching element at System.Linq.Enumerable.Single[TSource](IEnumerable1 source, Func2 predicate) at Abp.EntityHistory.EntityHistoryHelper.GetEntitySet(ObjectContext context, EntityType entityType) at Abp.EntityHistory.EntityHistoryHelper.CreateEntityChangeSet(DbContext context) at Abp.Zero.EntityFramework.AbpZeroCommonDbContext2.<SaveChangesAsync>d__104.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.EntityFramework.Uow.EfUnitOfWork.<SaveChangesInDbContextAsync>d__19.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.EntityFramework.Uow.EfUnitOfWork.<SaveChangesAsync>d__12.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at ProdMate.Portal.MultiTenancy.TenantManager.<CreateWithAdminUserAsync>d__9.MoveNext() in C:\Users\johntui\Source\Repos\ProdMate.Portal\ProdMate.Portal.Core\MultiTenancy\TenantManager.cs:line 113 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at ProdMat..."

I've only got the Default Tenant in place. Just doing an out of the box Create Tenant from the interface.

Any help much appreciated.

Cheers


2 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team
    • What is your product version?
    • What is your product type (Angular or MVC)?
    • What is product framework type (.net framework or .net core)?

    Related issues https://github.com/aspnetboilerplate/aspnetboilerplate/issues/4992 https://github.com/aspnetboilerplate/aspnetboilerplate/pull/4995

  • User Avatar
    0
    johntui created

    Thanks maliming , those links solved the problem. Cheers JT