从视图运行时如何修复Url(〜/ Views / Home / Index.cshtml)

Wil*_*lly 0 asp.net-mvc asp.net-mvc-routing razor asp.net-mvc-4

我正在使用MVC 4 VS 2012 Express for Web开发网站。通常,当我直接从视图中运行时,例如Home Controller中的Index View,我在URL地址栏上获得了“ http:// localhost:62335 / ”,但是现在我获得了http:// localhost:62335 / Views / Home /Index.cshtml

我不会在RouteConfig类上更改路由,如下面的代码所示

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 }
        );
    }
}
Run Code Online (Sandbox Code Playgroud)

为什么会发生这种情况以及如何解决?

Ash*_*Ash 5

尝试改为调用控制器:

http://localhost:62335/Home/
Run Code Online (Sandbox Code Playgroud)

转到项目的属性,然后设置起始页属性。