“This type of page is not served.” error when trying to browse on *.cshtml files

后端 未结 4 1760
礼貌的吻别
礼貌的吻别 2020-12-08 09:23

I just create a new MVC 4 Web API project, and create a new .cshtml file, containing very simple HTML:





    &         


        
4条回答
  •  心在旅途
    2020-12-08 10:00

    I had the same message in an MVC project and it turned out that I was missing a critical piece of the MVC framework, the Global.asax and Global.asax.cs entries. I selected the project in Solution Explorer and did an Add, New Item, Global Application Class. I then edited it and replaced the Application_Start with the necessary config items:

                protected void Application_Start()
                {
                    AreaRegistration.RegisterAllAreas();
                    FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
                    RouteConfig.RegisterRoutes(RouteTable.Routes);
                    BundleConfig.RegisterBundles(BundleTable.Bundles);
                }
    

    This solved it for me.

提交回复
热议问题