Я настраиваю пользовательский интерфейс IdentityServer4
для использования Angular, я создал SecurityController
с помощью конструктора:
public SecurityController(
MyDbContext dbContext,
UserManager<IdentityUser> userManager,
AbpSignInManager signInManager
)
{
_dbContext = dbContext;
_userManager = userManager;
_signInManager = signInManager;
}
Я получаю следующее исключение, когда я ссылаюсь на localhost:[port]/Security/[any action]
:
DependencyResolutionException: ни один из конструкторов, найденных с помощью «Autofac.Core.Activators.Reflection.DefaultConstructorFinder» для типа «Acme.[ProjectName].Controllers.SecurityController», не может быть вызван с доступными службами и параметрами: не удается разрешить параметр «Microsoft.AspNetCore. Identity.UserManager
1[Microsoft.AspNetCore.Identity.IdentityUser] userManager' of constructor 'Void .ctor(Acme.[ProjectName].EntityFrameworkCore.MyDbContext, Microsoft.AspNetCore.Identity.UserManager
1[Microsoft.AspNetCore.Identity.IdentityUser], Volo.Abp.Identity.AspNetCore.AbpSignInManager)'.
P.S. Если я удалю зависимость UserManager
, это сработает.
Есть идеи?
РЕДАКТИРОВАТЬ: Вот мой Startup.cs
:
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddApplication<MyIdentityServerModule>();
services.AddControllers();
}
public void Configure(IApplicationBuilder app)
{
app.InitializeApplication();
app.UseStatusCodePagesWithRedirects("~/index.html");
}
}
А вот MyIdentityServerModule
:
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
var env = context.GetEnvironment();
...
app.UseRouting();
...
app.UseAuthentication();
...
app.UseIdentityServer();
app.UseAuthorization();
...
}
Startup.cs
, чтобы показать нам, как вы регистрируете ASP.NET Core Identity? - person Métoule   schedule 06.10.2020