Questions tagged «asp.net-core-identity»

7
尝试激活“ 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"), …

1
找不到类型或名称空间名称“ IWebHostEnvironment”(您是否缺少using指令或程序集引用?)
我正在使用.NET Core 3.0.100; Microsoft Visual Studio Community 2019预览版本16.4.0预览版1.0; Blazor服务器(官方发行版)。 我正在尝试将身份验证和授权添加到我的Blazor服务器Web应用程序。我在这里阅读指南https://docs.microsoft.com/zh-cn/aspnet/core/security/authentication/scaffold-identity?view=aspnetcore-3.0&tabs=visual-studio#scaffold-identity-into-an -空项目 (我也阅读了这个https://github.com/aspnet/Identity/issues/1825) 然后,我右键单击Project,选择Add\New Scaffolded Item... 我读了文件ScaffoldingReadme.txt,然后按照指南进行操作。 我按F5进行调试,发现错误 Severity: Error Error Code: CS0246 Description: The type or namespace name 'IWebHostEnvironment' could not be found (are you missing a using directive or an assembly reference?) Project: foo File: C:\Users\donhuvy\Desktop\foo\bar\obj\Debug\netcoreapp3.0\Razor\Pages\Shared\_Layout.cshtml.g.cs Line: 455 Suppression …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.