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.
- Analysis of configuration files in ASP. NET
- . Net ria Services is as convenient as ASP. NET
- Overview of the UpdatePanel control in ASP. net ajax Extensions
- ASP. NET calls the UpdatePanel Update () method
- Introduction to the ASP. net ajax wcf Service