修改用户控制器AccountController,增加角色管理器. public class AccountController : Controller { public AccountController() { } public AccountController(ApplicationUserManager userManager, ApplicationSignInManager signInManager, ApplicationRoleManager roleManager ) {