Brief Introduction to asp.net dynamic compilation and prohibitions

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.