ASP.NET MVC rendering seems slow

后端 未结 4 1895
北恋
北恋 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条回答
  •  温柔的废话
    2021-01-29 22:45

    This could help improve ASP.NET MVC related performance issue , one performance improvement that you can do is to clear all the view engines and add the one(s) that you use. say for ex:- RazorViewEngine. MVC registers 2 view engines by default Webforms and Razor view engines, so clearing and adding the ones that is used alone will improve the look up performance.

    You can add this in global.asax Application_Start.

            ViewEngines.Engines.Clear();    
            ViewEngines.Engines.Add(new RazorViewEngine());      
    

    In order to completely utilize view look up caching and thus again performance gain compile the code in release mode and make sure that your web.config file is configured with for view look up caching to kick in.

提交回复
热议问题