I have been dabbling in the MVC framework and came across this error which threw me in a loop:
The controller for path ‘/foo/bar’ could not be found or it does not implement the IController interface.
Parameter name: controllerType

I finally realized that the Controller class name needs to be the controller name specified in the route dictionary with a suffix of “Controller”.
So, a route handler with controller = “foo”, action = “bar” maps to a method named “bar” in a controller class named “fooController”.

Silly oversight on my behalf because I was naming my class the same as the name of the controller. I wonder why the MVC team added a suffix.

As part of figuring this out, I came across a routing debugger tool:
http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx

About these ads