This happens during development. The only way to obtain the screenshot above is with a Debug build. The tenancy name is NOT being used as a subdomain, although I would like to be able to do that in the future.
ANZ: Angular/Core 3.0, version 8.0.0
Updated Microsoft packages to Core 3.0.1 and other packages: OK Cannot update Stripe.net, PayPalCheckoutSdk, Hangfire.SqlServer due to property incompatabilities.
Importing the PasswordModule was the solution.
When impersonating a User after logging in as host admin, the Exception identified at the start of this post ("There is no user with id: 1") is thrown when _userManager.GetUserByIdAsync(currentUser.Value);
is called.
Specific steps:
currentUser.Value = 1
, which is the host admin Id.Hi @olmy90 I had a similar problem on a project last year. You might have to upgrade to a non-free account to resolve this. I suggest you contact an Azure rep.
ERROR 2019-11-21 16:11:48,693 [35 ] Mvc.ExceptionHandling.AbpExceptionFilter - There is no user with id: 1
Abp.AbpException: There is no user with id: 1
at Abp.Authorization.Users.AbpUserManager`2.GetUserByIdAsync(Int64 userId) in D:\Github\aspnetboilerplate\src\Abp.ZeroCore\Authorization\Users\AbpUserManager.cs:line 340
// (more proprietary stack data omitted)
...occurs when attempting to get the impersonator User Id (Id = 1).
var susr = AbpSession.ImpersonatorUserId > 0
? AbpSession.ImpersonatorUserId
: AbpSession.UserId;
var rler = await _userManager.GetUserByIdAsync(susr.Value);
var rlerRoles = await _userManager.GetRolesAsync(rler);
The user with Id = 1 is created in HostRoleAndUserCreator.cs, and exists in the dbo.AbpUsers table.
private void CreateHostRoleAndUsers()
{
// (omitted code)
//admin user for host
var adminUserForHost = _context.Users.IgnoreQueryFilters().FirstOrDefault(u => u.TenantId == null && u.UserName == AbpUserBase.AdminUserName);
if (adminUserForHost == null)
{
var user = new User
{
TenantId = null,
UserName = AbpUserBase.AdminUserName,
Name = "admin",
Surname = "admin",
EmailAddress = "[email protected]",
IsEmailConfirmed = true,
ShouldChangePasswordOnNextLogin = false,
IsActive = true,
Password = "AM4OLBpptxBYmM79lGOX9egzZk3vIQU3d/gFCJzaBjAPXzYIK3tQ2N7X4fcrHtElTw==" //123qwe
};
user.SetNormalizedNames();
adminUserForHost = _context.Users.Add(user).Entity;
_context.SaveChanges();
// (omitted code)
}
When impersonating a User after logging in as tenant admin the code does not throw an exception. When impersonating a User after logging in as host atmin the code throws an exception.
EntityFrameworkCore/Migrations/ngMYAPPDbContextModelSnapshot.cs, ProductVersion has a lower version number than an earlier release. Is this intentional?
Version 7.2.3
modelBuilder
.HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
Version 8.0.0
modelBuilder
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
@maliming - Your suggetion worked.
@demox - You are right. I need to log in.