当前位置:网站首页>ASP. Net MVC - resource cannot be found error - asp Net MVC – Resource Cannot be found error

ASP. Net MVC - resource cannot be found error - asp Net MVC – Resource Cannot be found error

2022-07-07 05:04:00 fyin1314

problem :

I am completely new to ASP.Net MVC. I am a ASP.Net MVC novice .I just created an MVC3 project in Visual Studio 2010. The view engine is razor. I was just in Visual Studio 2010 Creates one in MVC3 project . The view engine is a razor .When I just ran the application it gave the proper result in the browser. When I first ran the application , It gives the correct result in the browser .The URL is http://localhost:4163/ .URL by http:// localhost:4163 / .Then I applied “Set as Start Page” to Index.cshtml inside ~\\Views\\Home folder. Then I will “ Set to start page ” be applied to 〜\\ Views \\ Home In folder Index.cshtml.Then when I ran the application the url became http://localhost:4148/Views/Home/Index.cshtml and it said the resource cannot be found. Then when I run the application ,url Turned into http:// localhost:4148 / Views / Home / Index.cshtml , It said that the resource could not be found .What do I do to correct it? What can I do to correct it ?Where is the url mapping done? Where is the URL mapping completed ?

Global.asax file:Global.asax file :

using System.Web.Mvc;using System.Web.Routing;namespace TEST{public class MvcApplication : System.Web.HttpApplication{    public static void RegisterGlobalFilters(GlobalFilterCollection filters)    {        filters.Add(new HandleErrorAttribute());    }    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        );    }    protected void Application_Start()    {        AreaRegistration.RegisterAllAreas();        RegisterGlobalFilters(GlobalFilters.Filters);        RegisterRoutes(RouteTable.Routes);    }    } }

Solution :

Reference resources : https://stackoom.com/en/question/czje
原网站

版权声明
本文为[fyin1314]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130739109969.html