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();

上面的就是把验证的机制去掉,就允许中文了

posted @ 2021-05-13 16:57  星星c#  阅读(1455)  评论(0编辑  收藏  举报