ASP.NET MVC rendering seems slow

后端 未结 4 1946
北恋
北恋 2021-01-29 22:01

I\'ve created a brand new MVC4 web application in Visual Studio, and done nothing more with it than add a Home controller and a \"Hello world\" index view for it. I then instal

4条回答
  •  萌比男神i
    2021-01-29 22:48

    Adding to @PSL 's answer - we only ever check for `.CSHTML files

    ViewEngines.Engines.Clear();
    
    IViewEngine razorEngine = new RazorViewEngine() { FileExtensions = new string[] { "cshtml" } };
    
    ViewEngines.Engines.Add(razorEngine);
    

    Also, make sure you are running in Release Mode - that is absolutely critical, as ASP/Razor/MVC 'applies some pretty aggressive caching' when in release mode

    in your Web.Config file.

    Sam Saffron/Stack Overflow looked into view rendering performance also:

    http://samsaffron.com/archive/2011/08/16/Oh+view+where+are+thou+finding+views+in+ASPNET+MVC3+

提交回复
热议问题