ASP.NET: Why does it take forever to load a page after compiling?
Why does it take forever for ASP.NET to process a request the first time you try to access the site after compiling?
Maybe it's just me but the first time I visit a page after I've compiled my project, it takes about 2开发者_JAVA百科0 seconds before I receive a response. Why is this?
This is because the pages are not completely "compiled" until you run them for the first time.
See the following page regarding Understanding ASP.NET Dynamic Compilation
The first load is slow because the just-in-time-compiler is kicking in. If you are using the Web Application model you are only compiling the code behind files. The markup files still need to compiled before they can be shown, and this is done in real time. If you are using the Web Site model both markup and code behind files a compiled just-in-time.
Microsoft's ASP.NET Compilation Tool can be used to pre-compile the whole web site, so that you can eliminate the first delay.
It really depends on what changes you've made.
If you've changed a single page then that is the only page that needs recompiling.
If you've changed/added code in app_code then the whole application needs to be recompiled.
精彩评论