Pre-compiled Web application-ASP. NET

Source: Internet
Author: User
Tags metabase

Developers of ASP. NET 1.x often hear users complain that initialization delays occur when applications are called for the first time. After all, the initial request will lead to a series of processes, including the initialization and Analysis of the Runtime Library, compiling the ASPX page into an intermediate language, and compiling the code of the method in real time.

Since ASP. NET became available, developers have been asking for a solution (Microsoft), while ASP. NET 2.0 provides an effective solution by using pre-compilation.

Pre-compile Web Applications

When the application is started for the first time, ASP. NET dynamically analyzes and compiles all ASP. NET files (aspx pages ). The runtime environment should buffer the compiled results to better serve all future requests.

After the server or Web server is restarted, the first time the application is started, the process needs to be restarted. In addition, any file changes to the application will be detected by the system, and the first time the application is run after the file changes, this process will happen again.

Many Web developers hate this initialization latency. Precompilation avoids this Latency by compiling the application in advance.

Command Line

You can start the pre-compilation by using the aspnet_compiler.exe program installed in the .netframework 2.0. It is located in the framework installation directory (the version number varies according to the installed Framework Version ). The following is the default path of the program:

C: <windows base directory> Microsoft. NET

Frameworkv2.0.5072aspnet_compiler.exe

You can use -? This command parameter is used to view the list of all parameters of the program. Below I will explain some available parameters:

M: This parameter indicates that you will use the complete IIS metabase path that the application will be precompiled. The path of the IIS metabase is/LM/W3SVC/1/Root/Application name.

V: Use the virtual IIS path of the Web application to be precompiled. The format of the virtual path is/Application name.

P: Use the physical IIS path of the Web application to be precompiled. It includes the drive name and the full path to the application directory. For example, c: the name of the inetpubwwwroot application. The v parameter must be used with p, so the compiler can parse the root reference of any application.

F: indicates whether the target directory is to be overwritten.

U: used to set the pre-compiled application to be updated. This means that all the tag files (ASPX, ASCX, and so on) can be updated in the target directory.

TargetDir: The target directory used to pre-compile the application file. The following command precompiled an application using the virtual path and the specified target path: aspnet_compiler.exe-v/Application name c: target directory name.

If no target directory is specified, the result file will be placed in the temporary file directory of ASP. NET, just like processing and compiling when ASP. NET Runtime Library calls the application for the first time. The default path of the temporary directory is as follows:

C: WindowsMicrosoft. NETFramework

V2.0.50727Temporary ASP. NET Files application name

Another advantage of pre-compilation is the ability to capture any errors that occur during the application startup phase. Errors are displayed in the tool, but the compilation process is not terminated.

  1. Analysis of configuration files in ASP. NET
  2. . Net ria Services is as convenient as ASP. NET
  3. Overview of the UpdatePanel control in ASP. net ajax Extensions
  4. ASP. NET calls the UpdatePanel Update () method
  5. Introduction to the ASP. net ajax wcf Service

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.