Reputation: 8154
When I run my ASP.NET MVC3 app locally in VS2010, it is throwing an immediate 404. This project used to work previously and I'm tearing my hair out to figure out what's going on.
The error message is:
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its
dependencies) could have been removed, had its name changed, or is
temporarily unavailable. Please review the following URL and make sure that
it is spelled correctly.
Requested URL: /
I've tried setting breakpoints in the controller but it's never hit. I have no idea how to debug or fix this. Any suggestions?
Upvotes: 0
Views: 3100
Reputation: 5468
Your error is from the routing engine.
The reason your breakpoints in the controller are not hit is because execution never gets that far. If a request doesn't match a route that would steer it to your controller you get a 404 (content/controller not found).
Of note is that the built-in routing engine does not work out of the box on xp/win2k3 machines.
Upvotes: 1
Reputation: 2678
routing engine couldn't find the default page ex: /Home/Index
that mean Index action in HomeController.
Check the global.asax for routing. There should be code like this:
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
Upvotes: 0