开发者

I have a parameterless public constructor but I am still getting an error saying I need one

开发者 https://www.devze.com 2023-01-11 06:17 出处:网络
The error is: An error occurred while creating a controller of type \'foo\'. If the controller doesn\'t have a controller

The error is:

An error occurred while creating a controller of type 'foo'. If the controller doesn't have a controller factory, ensure that it has a parameterless public constructor.

However, fooController has a parameterless public constructor. I'm using the default factory. As far as I kno开发者_如何学Gow, this code was working, and nothing has changed - I did install, then uninstall, MVC2.


Check that the constructor is both public and parameterless. Also check that the controller's type name ends with "Controller".


It turns out that you get this error if there's an exception throw in the constructor. Technically, the error message is correct, but the extra information is a bit misleading.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号