| • |
Deploy a new feature of pre-compilation-ASP. NET 2.0 that allows complete compilation of projects before deployment. During full compilation, all the code hidden files, aspx pages, HTML, graphic resources, and other back-end code are compiled into one or more executable sets, this depends on the application size and compilation settings. These assemblies contain all compiled web site code, and the resource files and configuration files are copied without modification. This compilation method provides the best performance and security at the cost of modifying the web site after deployment. If you use a highly visible or secure web site, this option is the best choice for final deployment. However, if you are building a small site that runs a Local intranet and the site is frequently changed, the complete pre-compilation may be a little too much. |
| • |
Complete runtime compilation-another extreme in the deployment of pre-compilation, ASP. NET 2.0 provides a new mechanism for compiling the entire application at runtime. That is to say, you can hide uncompiled code files and other related code in\ App_codeDirectory, And let ASP. NET 2.0 create and maintain references to the Assembly, these references will be generated according to these files at runtime. This option stores the uncompiled generation on the server ASP. NET 2.0 provides three different compilation models for Web applications:
| • |
Normal (ASP. NET1. x)-In a common ASP. NET web application, the hidden code file is compiled into an assembly and stored in/BinDirectory. Compile the web page (aspx) as required ). This model runs well for most web sites. However, the compilation process makes the first request for an ASP. NET page slower than the subsequent request. ASP. NET 2.0 continues to support this compilation model. |
| • |
Deploy a new feature of pre-compilation-ASP. NET 2.0 that allows complete compilation of projects before deployment. During full compilation, all the code hidden files, aspx pages, HTML, graphic resources, and other back-end code are compiled into one or more executable sets, this depends on the application size and compilation settings. These assemblies contain all compiled web site code, and the resource files and configuration files are copied without modification. This compilation method provides the best performance and security at the cost of modifying the web site after deployment. If you use a highly visible or secure web site, this option is the best choice for final deployment. However, if you are building a small site that runs a Local intranet and the site is frequently changed, the complete pre-compilation may be a little too much. |
| • |
The ASP. NET 2.0 compilation model also allows you to pre-compile all code hidden files of an application and update the code. You can compile the code hidden file and the original. aspx file (both local classes) into a pre-compiled class (the base class of the page ). If you select to edit the. aspx file at runtime, you only need to recompile the page. |
| • |
Complete runtime compilation-another extreme in the deployment of pre-compilation, ASP. NET 2.0 provides a new mechanism for compiling the entire application at runtime. That is to say, you can hide uncompiled code files and other related code in\ App_codeDirectory, And let ASP. NET 2.0 create and maintain references to the Assembly, these references will be generated according to these files at runtime. This option provides maximum flexibility in modifying web site content at the cost of storing uncompiled code on the server. |
Selecting the best compilation option depends on the actual situation and needs, but the compilation model must be flexible. Even if you select to use\ App_codeDirectory to store code hidden files, you can still use the complete compilation method to deploy the application. At the cost of code, it provides the maximum flexibility in changing the content of the Web site. Batch Compilation In ASP. NET 2.0, you can use a single URL request to batch compile any application. Like ASP. NET 1.x, batch compilation eliminates the latency of the first page request, but causes a longer start cycle. In addition, you must compile the code to hide files before deployment. The Web. config batch compilation settings still work in ASP. NET 2.0. The advantage of batch compilation is that the first user can use the page immediately and can detect any errors on the ASPX page during batch compilation. However, batch compilation does increase the latency of application startup and must be embedded in the web. config file. It should be noted that if a file has a problem, the batch will not receive it. Deploy pre-Compilation Deployment pre-compilation allows you to create one or more sets, which are executable versions of the web site. The obtained Assembly contains the compiled code of the web site. HTML pages, resources, configuration files, and aspx pages are copied separately. To deploy pre-compilation, you must use a command line utility called aspnet_compiler.exe. The utility creates a target deployment directory that contains/BinDirectory and stub files on various aspx pages. The utility is also used to pre-compile in situ, similar to calling "Magic pages. The stub file shares the name of the ASPX page, but contains simple code for calling compiled assembly. In other words, the ASPX page is just an empty shell rather than a full functional page. You can enhance security by deploying a pre-compiled web site, because only the decompiled assembly can access your code. To enhance protection, you can mess up the obtained Assembly to make your web application more secure. The main disadvantage of pre-compilation deployment is that these steps must be performed before deployment and the web site cannot be changed after deployment. To make changes, you must recompile the Web site and redeploy it. For most major Web applications, the deployment pre-compilation option is the preferred deployment mechanism because it reduces the number of original code deployed on the Web server and provides the best security. This added process can be built into the normal development/test/deployment cycle, and the work efficiency does not have much loss. Complete runtime compilation (\ app_code directory) In all the three compilation methods described currently, all the code files (Code hiding classes and support classes) must be compiled before deployment ). In ASP. NET 2.0, you have a code directory. \ App_codeA directory is a special directory for saving uncompiled classes. At runtime, the ASP. NET Runtime Library compiles the contents in this directory into a program set, and the ASPX page in the application automatically references the assembly. In other words, by using the code directory, you can avoid creating and referencing separate assemblies for supported code. The Code directory can be deployed without fully compiling the project, reducing the possibility of mismatch. The disadvantage is that uncompiled code may be exposed on the server. This option is most suitable for ASP. NET applications that do not require a large amount of code (in the form of code hidden files or external objects. Compared with more robust compilation methods, a simple application provides several advantages for rapid deployment and testing of system functions. |