ASP.NET Identity Manager的错误:试图创建类型“MetaController”(无参数的公共构造)的控制器时错误 [英] ASP.NET Identity Manager Error: error when trying to create a controller of type 'MetaController' (no parameterless public constructor)

查看:285
本文介绍了ASP.NET Identity Manager的错误:试图创建类型“MetaController”(无参数的公共构造)的控制器时错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我ThinkTecture的IdentityManager运行,但现在要在'/ IDM / URL时,我得到一个错误:

I got ThinkTecture's IdentityManager running, but now when going to the '/idm/ url I get an error:

An error occurred when trying to create a controller of type 'MetaController'. Make sure that the controller has a parameterless public constructor.

在<一评论中提到的错误href=\"http://stackoverflow.com/questions/30400093/asp-net-identity-manager-database-permissions\">another StackOverflow的问题,但这个问题的解决方案并没有给出。

The error was mentioned in a comment in another StackOverflow issue but a solution to this issue was not given.

推荐答案

在制定这个问题我也发现的 的IdentityManager GitHub库 的问题。我不得不在 IdentityConfig.cs ApplicationUserManager 构造从

While formulating this question I also found the solution in an issue of the IdentityManager GitHub repo. I had to change the constructor for ApplicationUserManager in IdentityConfig.cs from

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

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

和类似的类型变化创建函数仅低于把一切编译。

And a similar type change in the Create function just below that to get everything compiling.

在如下 ApplicationUserStore 应该定义。

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

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

哦,是的,我使用 唯一的真风格梅开二度这里 。如果这样帮你,请考虑切换,因为默认的C#约定(如奥尔曼风格)的所有不必要的空白总是要把我逼疯了。)

Oh yeah and I'm using The one true brace style here. If this helped you, please consider switching over, because all that unnecessary white space of the default C# convention (e.g. Allman style) always drives me crazy ;).

这篇关于ASP.NET Identity Manager的错误:试图创建类型“MetaController”(无参数的公共构造)的控制器时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆