When creating an ASP. NET Page, you actually create the source code of a. NET class and an instance of the System. Web. UI. Page class ). All content on the Asp.net page, including scripts and HTML content, will be compiled into the. NET class.
When an ASP. NET page is requested, the corresponding class of this page will be automatically detected. If there is no such page, it will be compiled into a new class, And the compiled class (assembly) will be saved in:
In the Temporary folder of WINDOWS \ Microsoft. NET \ Framework \ v2.0.50727 \ Temporary ASP. NET Files
The next time the page is accessed, it will not be compiled again. The previous compilation class will execute and return the result to the browser.
In this way, when the server is powered off for a long time and the server is started again, compilation is not required. Can we disable dynamic compilation? The answer is yes, but there are prerequisites:
Prohibit dynamic compilation (prohibit page without adding assembly to memory, which can save memory ):
CompilationMode has three attributes: Always, Auto, and Naver.
You only need to add CompilationMode = "Never" to @ Page to disable Page compilation.
To prohibit Compilation of the entire website, you need to set CompilationMode in the Pages attribute of Web. Config to disable dynamic compilation of the entire folder or a real application.
Note: For pages that contain server code and server controls, compilation cannot be disabled.