加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

ASP.NET Identity Manager错误:尝试创建“MetaController”类型

发布时间:2020-12-16 07:20:24 所属栏目:asp.Net 来源:网络整理
导读:我运行了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. 在another Stac
我运行了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.

在another StackOverflow issue的评论中提到了该错误,但未给出该问题的解决方案.

enter image description here

解决方法

在制定这个问题时,我也在 an issue of the IdentityManager GitHub repo中找到了解决方案.我必须在IdentityConfig.cs中更改ApplicationUserManager的构造函数:

public ApplicationUserManager(IUserStore<ApplicationUser> store): base(store) {}

至:

public ApplicationUserManager(ApplicationUserStore store): base(store) {}

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

ApplicationUserStore应定义如下.

public class ApplicationUserStore: UserStore<ApplicationUser>
{
    public ApplicationUserStore(ApplicationDbContext ctx): base(ctx) {}
}

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读