ASP.NET Identity Manager错误:尝试创建"MetaController"类型的控制器时出错(无参数公共构造函数)

Bar*_*art 4 asp.net thinktecture-ident-server asp.net-identity

我运行了ThinkTecture的IdentityManager,但现在当转到'/ idm/url时出现错误:

An error occurred when trying to create a controller of type 'MetaController'. Make sure that the controller has a parameterless public constructor.
Run Code Online (Sandbox Code Playgroud)

另一个StackOverflow问题的评论中提到了错误,但没有给出解决此问题的方法. 在此输入图像描述

Bar*_*art 7

在制定这个问题时,我也找到了解决方案an issue of the IdentityManager GitHub repo.我不得不改变ApplicationUserManagerin 的构造函数IdentityConfig.cs:

public ApplicationUserManager(IUserStore<ApplicationUser> store): base(store) {}
Run Code Online (Sandbox Code Playgroud)

至:

public ApplicationUserManager(ApplicationUserStore store): base(store) {}
Run Code Online (Sandbox Code Playgroud)

并且在Create下面的函数中进行类似的类型更改以获得所有编译.

ApplicationUserStore如下加以界定.

public class ApplicationUserStore: UserStore<ApplicationUser>
{
    public ApplicationUserStore(ApplicationDbContext ctx): base(ctx) {}
}
Run Code Online (Sandbox Code Playgroud)

我把它放在Startup.cs声明的上方ApplicationRoleStore.