How to deploy an ASP. NET page?

Source: Internet
Author: User

From: http://hi.baidu.com/%CF%F4%CF%F4gd/blog/item/6dc88d0f6f178c326a60fb0c.html

This is a written test question I have encountered. I am not very clear about it when I write it. I learned it.

1. Use xcopy for deployment

2. Use the copy web site function of Visual Studio for deployment

3. Use precompilation pre-compilation and deployment of Visual Studio

The following three methods are described respectively:

Use xcopy for deployment

First, use Visual Studio express to create a web site, select VB. NET or C #, and then create an application named deployment. In this application, because our purpose is to focus on installation and deployment, you can pull a button and then in The onclick event of this button, write some screen output statements.
When thisProgramThen, we began to use xcopy to deploy the application. Xcopy is the simplest method for. NET application deployment. Xcopy simply copies all files of your web application to a specified path on the target server. For example, run the following command:
Xcopy D:/intetpub/wwwroot/myprojects/developer/deployment C:/temp/e/k/R/O/h/I

After the execution, the result is as follows: all files of the current application deployment will be copied to the temp directory of drive C. Then, create a virtual directory in IIS and point to the directory. For how to use xcopy, refer to the relevant Command help.


Figure 1

Use the copy web site function of Visual Studio for deployment

Visual Studio's copy web site function allows us to conveniently deploy and install Web applications. By using this function, you can copy a web project to the same server, other servers, or FTP. However, when using this function, you only need to copy the file to the destination path without executing any compilation operations.
In Visual Studio Express, select copy web site from the web-site menu. The following dialog box is displayed:


Figure 2

The left part is the source web site path and the right part is the target path to be deployed. Pay attention to the drop-down selection box under move files on the right, which provides three file replication methods for you to choose from:

1. All source web files to remote web site (all web files are copied to remote web sites)

2. All remote web files to source web site (all remote web site files are copied to the local site)

3. Synchronize source and remote web sites (Synchronize files of local and remote web sites ).

Click connecting... The following dialog box appears:


Figure 3


Here, you can select where your local web application is copied, such as file system, local IIS, and FTP sites, or remote site. After selecting the target path, you can click the "Copy web site" button. The system automatically copies the files of the application system to the target path and displays the copied logs.

 

Use precompilation pre-compilation and deployment of Visual Studio

ASP. A new feature in net 2.0 is dynamic compilation, which allows you to directly access the webpage after editing or saving the modified webpage, without re-compiling, however, this has a disadvantage. The compilation process will lead to the first request to ASP. the response speed of the net page is slower than that of subsequent requests, while. in NET 2.0, precompiling is also provided. With this function, the results can be immediately displayed to the first user, any errors on the ASPX page can be detected during the batch compilation process. However, batch compilation does extend the application startup time and must be embedded in the web. config file.

ASP. NET 2.0 pre-compilation can be divided into two types. The first type is in-place compilation. You only need to enter http: // site name/webapp name/precompile in the browser. axd, the system will compile all the pages in the webapp first, after running, as shown in:


Figure 4

ASP. NET 2.0 provides an update compilation and deployment method called precompilation deployment ). Net Framework 2.0configure a command line tool (aspnet_compiler.exe), you canCode, Pages (including HTML), static files are all compiled into DLL, and then deployed. The resulting target system contains only the compiled DLL, and even HTML page files do not exist, greatly enhances the security of the system, but browsing and common ASP. NET applications. The usage is as follows:

Aspnet_compiler.exe can be found in the. NET Framework 2.0 subdirectory under the WINNT directory in the following format:

Aspnet_compiler-V/<websitename>-P <source> <destination>

Specifically, websitename is the virtual directory name of the Web application to be deployed, and <source> is the physical path of the Web application to be deployed, <destination> is the physical path of the application to be deployed, for example:

Aspnet_compiler-V/deployment
-P c:/inetpub/wwwroot/myprojects/developer/deployment C:/compiled

All files will be pre-compiled to the compiled directory of drive C. In this directory, you will find that there are no code files or HTML files.

 

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.