ASP.NET MVC Page Won't Load and says “The resource cannot be found”

前端 未结 21 1774
猫巷女王i
猫巷女王i 2020-12-09 14:51

I am having a problem where I try to open my ASP.NET MVC application but I get the ASP.NET error page which says this:

Server Error in \'/\' Applicati

21条回答
  •  清歌不尽
    2020-12-09 15:31

    You should carefully review your Route Values.

    routes.MapRoute(
       "Default", // Route name
       "{controller}/{action}/{id}", // URL with parameters
       new { controller = "Home", action = "Index", id = UrlParameter.Optional } 
    

    In this case, ensure you have your Controller 'Home' as the application will fail to load if there is no HomeController with Index Action. In My case I had HomesController and I missed the 's' infront of the Home. I Fixed the Name mismatch and this resolved the issue on both my local environment and on my server.

提交回复
热议问题