C# 带有identityrole的.net core 2.0冲突解决程序问题

C# 带有identityrole的.net core 2.0冲突解决程序问题,c#,asp.net-mvc,asp.net-identity,asp.net-core-2.0,C#,Asp.net Mvc,Asp.net Identity,Asp.net Core 2.0,我将IdentityRole用户键定制为int而不是string。这就是我试图将其添加到服务集合的方式 首先,我的应用程序用户从identityUser继承 公共类应用程序用户:IdentityUser…… 然后在我的服务集合中: services.AddIdentity<ApplicationUser, IdentityRole<int>>(options => { // Password settings opti

我将IdentityRole用户键定制为int而不是string。这就是我试图将其添加到服务集合的方式

首先,我的应用程序用户从identityUser继承

公共类应用程序用户:IdentityUser……

然后在我的服务集合中:

services.AddIdentity<ApplicationUser, IdentityRole<int>>(options => {
            // Password settings
            options.Password.RequireDigit = true;
            options.Password.RequiredLength = 8;.......`
services.AddIdentity(选项=>{
//密码设置
options.Password.RequireDigit=true;
options.Password.RequiredLength=8`
在基本控制器中,我有以下构造函数:

public BaseApiController(RoleManager<IdentityRole> roleManager, UserManager<ApplicationUser> userManager, IConfiguration configuration, ILogger<BaseApiController> logger) : base(logger)
        {
            _roleManager = roleManager;
            _userManager = userManager;
            _configuration = configuration;

            _jsonSettings = new JsonSerializerSettings() { Formatting = Formatting.Indented };
        }
public-BaseApiController(rolemager-rolemager,UserManager-UserManager,IConfiguration-configuration,ILogger-logger):base(logger)
{
_roleManager=roleManager;
_userManager=userManager;
_配置=配置;
_jsonSettings=new JsonSerializerSettings(){Formatting=Formatting.Indented};
}
然后,我在一个mvc控制器上使用基本控制器,其形式如下:

 public class RegisterController : BaseApiController
    {
        private readonly IAccountService _accountService;

        public RegisterController(RoleManager<IdentityRole> roleManager, UserManager<ApplicationUser> userManager, IConfiguration configuration, ILogger<RegisterController> logger, IAccountService accountService) : base(roleManager, userManager, configuration, logger)
        {
            _accountService =  accountService;

        }
公共类注册控制器:BaseApiController
{
私有只读IAccountService\u accountService;
公共注册表控制器(RoleManager RoleManager、UserManager UserManager、IConfiguration配置、ILogger记录器、IAccountService accountService):基本(RoleManager、UserManager、配置、记录器)
{
_accountService=accountService;
}
现在,当我使用swagger运行时,我收到以下错误:

处理请求时发生未处理的异常,无法恢复 解析Microsoft.AspNetCore.Identinty.RoleManager类型的服务 试图激活时 Myprog.Areas.Account.Controller.RegisterController


基本控制器需要在调用中分配,然后在所有实现中执行以下操作:

public BaseApiController(RoleManager<IdentityRole<int>> roleManager, UserManager<ApplicationUser> userManager, IConfiguration configuration, ILogger<BaseApiController> logger) : base(logger)
public-BaseApiController(rolemager-rolemager,UserManager-UserManager,IConfiguration-configuration,ILogger-logger):base(logger)