Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to precompile Web applications by ASP.NET

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you how ASP.NET pre-compiled Web applications, I believe that most people do not know much, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Developers of ASP.NET 1.x often hear users complain about initialization delays when calling applications. After all, the initial request triggers a series of processes, including runtime initialization, analysis, compilation of ASPX pages into an intermediate language, real-time compilation of methods into native code, and so on.

Since the launch of ASP.NET, developers have been asking for a solution, and ASP.NET 2.0 provides an effective solution using precompilation.

Precompile Web application

When * * starts the application, ASP.NET dynamically parses and compiles all ASP.NET files (aspx pages). The runtime environment buffers the compiled results in order to better serve all future requests.

Starting the application * * times also means that the process starts again after the server is restarted or the Web server is restarted. Also, any file changes to the application will be detected by the system, and running the application after the file changes will make the process happen again.

Many Web developers hate this initialization delay. Precompilation avoids this delay by (pre -) compiling the application.

Command Lin

Precompilation can be started through the aspnet_compiler.exe program installed in the .NET Framework 2.0. It is located in the framework installation directory (the version number varies depending on the version of the framework installed). Here is the default path for this program:

C:

< windows base directory>

Microsoft.NET

Frameworkv2.0.5072aspnet_compiler.exe

Can you use -? This command parameter looks at the list of all the parameters for the program. Let me explain some of the available parameters:

M: this parameter indicates that you will use the complete IIS Metabase path that the application will be precompiled. The path to the IIS Metabase is / LM/W3SVC/1/Root/ application name.

V: use the virtual IIS path where the Web application needs to be precompiled. The format of the virtual path is: / application name.

P: use the physical IIS path where the Web application needs to be precompiled. It includes the drive name and the full path to the application directory. For example, the name of the c:inetpubwwwroot application. The parameter v 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: the precompiled application can be updated. This means that all tag files (ASPX, ASCX, and so on) can be updated in the target directory.

TargetDir: the target directory used to precompile application files. The following command precompiles an application with 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 resulting file will be placed in the temporary file directory of ASP.NET, just as the ASP.NET runtime handles compilation when the application is called. The default path to the temporary directory is as follows:

C:WindowsMicrosoft.NETFramework

V2.0.50727Temporary ASP.NET Files Application name

Another benefit of precompilation is the ability to catch any errors that occur during the startup phase of the application. Errors are displayed in the tool, but do not terminate the compilation process.

The above is all the content of the article "how to precompile Web applications by ASP.NET". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report