Reputation: 917
I am really really really new to ASP MVC and I want to add a default controller to the projcet.
I searched for this topic but none of theme helped to me like :
ASP.NET MVC Routing with Default Controller
and ...
How can add a default controller to the project to prevent application error?
When I browse the http://localhost:8688/
, I see an error: The resource cannot be found.
Upvotes: 0
Views: 94
Reputation: 16613
Normally when you create a new MVC based application there's a default setting in the Global.asax.cs file:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new {controller = "Home", action = "Index", id = UrlParameter.Optional} // Parameter defaults
);
}
So the default controller would be called HomeController in the Controllers subfolder. and the default action would be Index.
Check if you have that in the Global.asax.cs and also have a HomeController class.
Likely you selected to create an empty MVC application which doesn't put a HomeController class in it and gives an error when you hit F5 (what's not there can't be executed).
Upvotes: 1