I have a parameterless public constructor but I am still getting an error saying I need one
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.
精彩评论