ASP.NET MVC rendering seems slow

后端 未结 4 1897
北恋
北恋 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:48

    Views are compiled before use - so on the first occasion they are slow.

    Subsequently they are recompiled if the .cshtml file changes - which means the directories that views are stored in are being monitored. So hard disk speed will be a factor for MVC views.

    Even if they do nothing, each rendering engine checks the hard disk for .cshtml or .aspx files. Since removing a rendering engine made it run twice as fast, I suspect disk speed is the problem:

    • Views are stored on a network drive, or
    • Hard disk is very slow

提交回复
热议问题