title: The controller for path '/Home' was not found or does not implement IController
body: <p>I've searched the internet high and low and checked all previously answered questions with the same title and I cannot figure this one out.  </p>
  
  <p>I return <strong>RedirectToAction("Index", "Home")</strong> from the action method in my authentication controller and then receive the following exception:</p>
  
  <pre><code>Server Error in '/' Application.
  The controller for path '/Home' was not found or does not implement IController.
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
  
  Exception Details: System.Web.HttpException: The controller for path '/Home' was not found or does not implement IController.
  
  Source Error:
  
  An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
  
  Stack Trace:
  
  
  [HttpException (0x80004005): The controller for path '/Home' was not found or does not implement IController.]
     System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +683921
     System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +89
     Castle.Proxies.Invocations.IControllerFactory_CreateController.InvokeMethodOnTarget() +155
     Castle.DynamicProxy.AbstractInvocation.Proceed() +116
     Glimpse.Core.Extensibility.ExecutionTimer.Time(Action action) +85
     Glimpse.Core.Extensibility.AlternateMethod.NewImplementation(IAlternateMethodContext context) +186
     Castle.DynamicProxy.AbstractInvocation.Proceed() +604
     Castle.Proxies.IControllerFactoryProxy.CreateController(RequestContext requestContext, String controllerName) +193
     System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController&amp; controller, IControllerFactory&amp; factory) +305
     System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +87
     System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Func`1 func) +41
  
  [HttpException (0x80004005): Execution of the child request failed. Please examine the InnerException for more information.]
     System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Func`1 func) +785832
     System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +3977
     System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage) +275
     System.Web.HttpServerUtilityWrapper.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm) +94
     System.Web.Mvc.Html.ChildActionExtensions.ActionHelper(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues, TextWriter textWriter) +700
     System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues) +123
     Panoptes.Ui.Web.Views.Home.Index.Execute() in c:\Dropbox\Energy Management System\Application\Panoptes\Panoptes.Ui.Web\obj\CodeGen\Views\Home\Index.cshtml:48
     System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280
     System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +126
     System.Web.WebPages.StartPage.ExecutePageHierarchy() +143
     System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +181
     RazorGenerator.Mvc.PrecompiledMvcView.Render(ViewContext viewContext, TextWriter writer) +952
     System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +378
     Castle.Proxies.AsyncControllerActionInvokerProxy.InvokeActionResult_callback(ControllerContext controllerContext, ActionResult actionResult) +21
     Castle.DynamicProxy.AbstractInvocation.Proceed() +116
     Glimpse.Core.Extensibility.ExecutionTimer.Time(Action action) +85
     Glimpse.Core.Extensibility.AlternateMethod.NewImplementation(IAlternateMethodContext context) +186
     Castle.DynamicProxy.AbstractInvocation.Proceed() +604
     System.Web.Mvc.&lt;&gt;c__DisplayClass1a.&lt;InvokeActionResultWithFilters&gt;b__17() +33
     System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +854172
     System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +854172
     System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +265
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass25.&lt;BeginInvokeAction&gt;b__22(IAsyncResult asyncResult) +838644
     System.Web.Mvc.&lt;&gt;c__DisplayClass1d.&lt;BeginExecuteCore&gt;b__18(IAsyncResult asyncResult) +28
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass4.&lt;MakeVoidDelegate&gt;b__3(IAsyncResult ar) +15
     System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +65
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass4.&lt;MakeVoidDelegate&gt;b__3(IAsyncResult ar) +15
     System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +51
     System.Web.Mvc.&lt;&gt;c__DisplayClass8.&lt;BeginProcessRequest&gt;b__3(IAsyncResult asyncResult) +42
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass4.&lt;MakeVoidDelegate&gt;b__3(IAsyncResult ar) +15
     System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +51
     System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
     System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +288
  
  
  Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18034
  </code></pre>
  
  <p>The authentication controller looks as follows:</p>
  
  <pre><code>    public class AuthenticationController : Controller
  {
      private ILogService _logService;
      private IEmailProvider _emailProvider;
      private IMembershipProvider _membershipProvider;
      private IAuthenticationProvider _authenicationProvider;
  
      public AuthenticationController(ILogService logService, IEmailProvider emailProvider, IMembershipProvider membershipProvider, IAuthenticationProvider authenicationProvider)
      {
          _logService = logService;
          _emailProvider = emailProvider;
          _membershipProvider = membershipProvider;
          _authenicationProvider = authenicationProvider;
      }
  
      [AllowAnonymous]
      [HttpGet]
      ////[OutputCache(Duration = 3600, VaryByParam = "none")]
      public ActionResult Index()
      {
          return View();
      }
  
      [AllowAnonymous]
      [HttpPost]
      [ValidateHttpAntiForgeryToken] 
      public ActionResult Login(LoginModel model, string returnUrl)
      {
          if (Request.IsAuthenticated)
          {
              return RedirectToAction("Index", "Home");
          }
  
          if (ModelState.IsValid)
          {
              if (_membershipProvider.ValidateUser(model.Username, model.Password))
              {
                  _authenicationProvider.AuthenticateUser(model.Username);
                  ////this.HttpContext.User = new GenericPrincipal(new GenericIdentity(model.Username), null);
  
                  if (!string.IsNullOrEmpty(returnUrl))
                  {
                      if (Url.IsLocalUrl(returnUrl))
                      {
                          return Redirect(returnUrl);
                      }
                      else
                      {
                          _logService.Log(new SecurityException(string.Format("Open redirect to {0} detected (Username {1})", returnUrl, model.Username)));
                          return View("Index", model);
                      }
                  }
                  else
                  {
                      return RedirectToAction("Index", "Home");
                  }
              }
              else
              {
                  ModelState.AddModelError(string.Empty, Resources.Controller.View.Authentication.Index.IncorrectUsernamePassword);
              }
          }
  
          return View("Index", model);
      }
  
      [AllowAnonymous]
      [HttpPost]
      [ValidateHttpAntiForgeryToken] 
      public ActionResult ForgotPassword(LoginModel model)
      {
          if (ModelState.IsValidField("Username"))
          {
              if (!_membershipProvider.EnablePasswordRetrieval)
              {
                  throw new Exception(Resources.Controller.View.Authentication.Index.PasswordRetreivalNotAllowed);
              }
  
              IMembershipUser user = _membershipProvider.FindUsersByName(model.Username).FirstOrDefault();
  
              if (user != null)
              {
                  try
                  {
                      _emailProvider.Send(ConfigurationHelper.GetSmtpSettings().Smtp.From, user.EmailAddress, Resources.Global.PasswordRecoveryEmailSubject, user.GeneratePasswordRetreivalEmail());
                      ModelState.AddModelSuccess(Resources.Controller.View.Authentication.Index.PasswordSentViaEmail);
                  }
                  catch (Exception ex)
                  {
                      _logService.Log(ex);
                      ModelState.AddModelError(string.Empty, Resources.Controller.View.Authentication.Index.UnableToRetreivePassword);
                  }
              }
              else
              {
                  ModelState.AddModelError(string.Empty, Resources.Controller.View.Authentication.Index.EmailAddressDoesNotExist);
              }
          }
  
          ViewBag.ShowForgottenPasswordForm = "true";
  
          return View("Index", model);
      }
  
      [HttpGet]
      public ActionResult Logout()
      {
          _authenicationProvider.Logout();
          ModelState.AddModelInformation(Resources.Controller.View.Authentication.Index.Logout);
          return View("Index");
      }
  }
  </code></pre>
  
  <p>My HomeController looks as follows:</p>
  
  <pre><code>public class HomeController : Controller
  {
      private IMembershipProvider _membershipProvider;
      private IAuthenticationProvider _authenticationProvider;
  
      public HomeController(IMembershipProvider membershipProvider, IAuthenticationProvider authenticationProvider)
      {
          _membershipProvider = membershipProvider;
          _authenticationProvider = authenticationProvider;
      }
  
      public ActionResult Index()
      {
          return View(_membershipProvider.GetCurrentUser());
      }
  }
  </code></pre>
  
  <p>See below my RouteConfig:</p>
  
  <pre><code>public class RouteConfig
  {
      public static void RegisterRoutes(RouteCollection routes)
      {
          routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  
          routes.MapRoute(
              name: "Default",
              url: "{controller}/{action}",
              defaults: new { controller = "Authentication", action = "Index" });
      }
  }
  </code></pre>
  
  <p>RouteDebugger returns TRUE for the routes {controller}/{action} and {*catchall} and confirms the AppRelativeCurrentExecutionFilePath as: ~/Home</p>
  
  <p>I have debugged the code and I can successfully debug and step into the HomeController constructor and Index action method.  I have also been able to step into the "~/Views/Home/Index.cshtml" however it throws the exception at the line of code:</p>
  
  <pre><code>&lt;span class="username"&gt;@Model.UserName&lt;/span&gt;
  </code></pre>
  
  <p>Funnily enough, before I step into this code I can add "@Model.UserName" to my list of watches and I can see the object and its properties fine, but for some reason it throws an exception when stepping into or over this line of code.</p>
  
  <p>If the debugger steps into the HomeController, the Index action method and the Index view, then why is it all of a sudden throwing the exception it can't find the HomeController for the path "~/Home"?</p>
  
  <p>The captured fiddler data can be found at the following link: <a href="http://d-h.st/IqV" rel="nofollow">http://d-h.st/IqV</a></p>
  
  <p>I have used Razor Generator to compile my views and I am also using Ninject.Mvc to resolve my controllers.  It's also worth mentioning I have cleared down and re-generated the compiled views and my project does not contain any registered areas.</p>
  
  <p>Any idea's? this might be simple or an obvious one but I'm new to MVC and am reading/learning as I go.</p>
  
  <p>Thanks</p>