尝试激活“ AuthController”时无法解析类型为“ Microsoft.AspNetCore.Identity.UserManager”的服务
我在登录控制器中收到此错误。 InvalidOperationException:尝试激活“ Automobile.Server.Controllers.AuthController”时,无法解析类型为“ Microsoft.AspNetCore.Identity.UserManager`1 [Automobile.Models.Account]”的服务。 这是Auth Controller构造函数: private SignInManager<Automobile.Models.Account> _signManager; private UserManager<Automobile.Models.Account> _userManager; public AuthController(UserManager<Models.Account> userManager, SignInManager<Automobile.Models.Account> signManager) { this._userManager = userManager; this._signManager = signManager; } 这是startup.cs中的ConfigureServices: public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddApplicationInsightsTelemetry(Configuration); services.Configure<AppConfig>(Configuration.GetSection("AppSettings")); //var provider = HttpContext.ApplicationServices; //var someService = provider.GetService(typeof(ISomeService)); services.AddDbContext<Providers.Database.EFProvider.DataContext>(options => options .UseSqlServer(Configuration.GetConnectionString("DefaultConnection"), …