0

My application (ASP.NET MVC 4) was working until a few hours ago and just recently I got this error:

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

I test parts of application and find that it will be happend when I call a Html.Action or Html.RenderAction helper. I should tell you I googled and SOed the error and find some articles but none of them resolved the problem. It seems every thing is OK. My routing system and calling the helpers and... every thing seems is OK. Is there any bit point about using Action and RenderAction?

OH, I should to tell you, it happened just after I copy/paste some controller and views from another project to current project. But I check namespaces and files exists and every thing. Any suggestion please? I am currently hanged.

amiry jd
  • 27,021
  • 30
  • 116
  • 215
  • Do any controllers get called successfully? – Adam Tuliper Dec 23 '12 at 10:03
  • Are you certain the classes inherit from controller and the namespaces match perfectly - case and all? – Adam Tuliper Dec 23 '12 at 10:19
  • Perhaps you could post the route that *should* hit your controller, the controller and your RenderAction call. – Ben Foster Dec 23 '12 at 10:33
  • @AdamTuliper all controllers get called successfully and inheritance and namespaces are correct. – amiry jd Dec 23 '12 at 18:11
  • You could install the glimpse.mvc3 package ten get the code and recompile so it works for 404 as well (simply adding the 404 number to an array in glimpse) and then you'll see the routes that were checked and missed for your action. Sounds more complex than it is let me know if you want more hell with that – Adam Tuliper Dec 23 '12 at 22:08
  • @AdamTuliper I tryied glimpse but when application has error and can not run, glimpse does not help (because of error pointed on question). But I test some more partial views with actions, I mean I create some actions to render with Html.Action. It seems that application can not run any partial action. Have you any idea? I'm using DI. – amiry jd Dec 23 '12 at 23:18
  • How are you using DI here? If it works for your regular controllers using constructor injection it should still work here without a prob. Create a new controller without DI support to test calling a child action on. Just return Content("test") from the action method. See if that works excluding DI – Adam Tuliper Dec 25 '12 at 21:39

0 Answers0