Showing posts with label MVC. Show all posts
Showing posts with label MVC. Show all posts

7/20/2019

The controller for path '/' was not found or does not implement IController #VisualStudio #MVC



The controller for path '/' was not found or does not implement IController


Some error messages are no help at all!


When running in Debug mode Visual Studio reports:

An exception of type 'System.Web.HttpException' occurred in System.Web.dll but was not handled in user code.
Additional information: Execution of the child request failed. Please examine the InnerException for more information.

The inner exception:

{System.Web.HttpException (0x80004005): The controller for path '/' was not found or does not implement IController.
   at System.Web.Mvc.DefaultControllerFactory.GetControllerInstance


A "forest and trees" problem...


A web search returns many possibilities for the error, but none that applied to my project. It turns out I had one of those "forest and trees" problems! I had typed Html.Action instead of Html.ActionLink in a Layouts page. In effect I was asking the layouts view to load a view that used the layouts view that then loaded the layouts view that loaded the view that used the layouts view… Yup, an endless loop.


The error message was not of much help and sent me on a wild goose chase. Once I realized what was going on I made one small edit and was back in business.



.

Note to spammers!

Spammers, don't waste your time... all posts are moderated. If your comment includes unrelated links, is advertising, or just pure spam, it will never be seen.