aspnetboilerplate: [AbpException: There is no role with name: Admin]
i have a view for creating Tenant, in application service method i have a method that create tenant with admin role and user. i use role repository not role manager, when i try to login with the new created user , i got this exception
Abp.AbpException: There is no role with name: Admin
at Abp.Authorization.Roles.AbpRoleManager`3.<GetRoleByNameAsync>d__3d.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.Authorization.Roles.AbpRoleManager`3.<HasPermissionAsync>d__0.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.ValidateEnd(Task task)
at Abp.Authorization.Users.AbpUserManager`3.<IsGrantedAsync>d__4.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.Authorization.Users.AbpUserManager`3.<IsGrantedAsync>d__0.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.Authorization.PermissionChecker`3.<IsGrantedAsync>d__3.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.Web.Authorization.AuthorizationScriptManager.<GetScriptAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown -
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 16 (11 by maintainers)
This issue occurred again and I solved it by executing the following SQL to my database:
When you create a role manually it is necessary to call
role.SetNormalizedName()
, otherwise any GUID will be saved in the database and the permissions will not work.You’re right. We should set TenantId if multitenancy is disabled. I’m creating an issue to set it in the next versions.
This may be related to multitenancy filters. Please share a screenshot of AbpRoles table. Also, are you working on default tenant? And lastly which version of EntityFramework.DynamicFilters are you using?