Reputation: 1729
I'm using MVC 4 VS 2012 Express for Web to develop a site. Usually when I directly run from the view, for example Index View in Home Controller, I got 'http://localhost:62335/' on the url address bar, but now I got http://localhost:62335/Views/Home/Index.cshtml
I don't change the routing on RouteConfig class, as you can see in the code below
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
Why this could happen and how to fix it?
Upvotes: 0
Views: 11730
Reputation: 1
Upvotes: 0
Reputation: 6683
I post this answer to make a clear answer and find it easier
As answered in ASP.Net MVC – Resource Cannot be found error
You should go to Project Properties
then Web Tab
and leave it blank.
I'm wondering why we should fiax it manually!
Upvotes: 0
Reputation: 2595
Try to call the controller instead :
http://localhost:62335/Home/
Go to your project's properties and set the start page property.
Go to the project's Properties
Go to the Web tab
Upvotes: 6