identity server4里遇到:User name '' is invalid, can only contain letters or digits的解决方式
private readonly UserManager<IdentityUser> _userManager; private readonly RoleManager<IdentityRole> _roleManager; public HomeController(IIdentityServerInteractionService interaction, UserManager<IdentityUser> userManager, RoleManager<IdentityRole> roleManager, IWebHostEnvironment environment) { _roleManager = roleManager; _userManager = userManager; _interaction = interaction; Environment = environment; _roleManager.RoleValidators.Clear(); userManager.UserValidators.Clear(); }
_roleManager.RoleValidators.Clear();
userManager.UserValidators.Clear();
上面的就是把验证的机制去掉,就允许中文了