Deploy three major ASP. NET technologies (1)

Source: Internet
Author: User

Outline:

I. Overview

Ii. Structure of ASP. NET Web applications

Iii. deployment mechanism supported by ASP. NET

4. Use the XCOPY command to deploy

V. Use the "Copy project" function of VS. NET to deploy

Vi. Web-based installation project deployment

6.1 Windows Installer

6.2 VS. NET Web installation project features

7. Create a Web installation project

8. Install ASP. NET Web applications

IX. Conclusion

Body:

I. Overview

Understanding the difference between Setup and Deployment is necessary before you go deep into the specific steps for configuring and deploying ASP. NET Web applications. Configuration refers to packaging an application into easy deployment mode. After packaging, the application can be conveniently installed on the target server. Deployment is a process of obtaining an application and installing it on another machine. It is generally completed by the installation program.

Many users have encountered the vulnerability of Windows Software Installation Technology-when we install a new version of the software, the installer copies the new version of the dll file to the system directory, perform all necessary registry modification operations at the same time. However, installation operations may affect other software running on the same machine, especially when the original software and newly installed software share a certain component, problems are more likely to occur. If the newly installed component is backward compatible with its earlier versions, it is certainly no problem, but in many cases it is difficult to achieve full backward compatibility, therefore, we often encounter a situation where the original software is damaged after a new software is installed, which is the notorious DLL Hell problem.

One of the design goals of Visual Studio. NET (VS. NET) is to solve the problems frequently encountered during installation of Windows software. Many functions of the VS. NET application depend on the. NET Framework class library. the. NET Framework class library creates a new programming model, which greatly simplifies the installation process. In addition, the VS. NET application is compiled into an Assembly, which is a deployment unit consisting of one or more files that support Assembly running. Microsoft. the. NET Framework introduces many new features that simplify application deployment and solve the DLL Hell problem. For example, the configuration information can be saved on the web. config configuration file, web. the config configuration file is an XML text file that can be directly copied and deployed to the target server using commands such as XCOPY.

Before discussing various deployment mechanisms, let's first take a look at the structure of ASP. NET applications, because this structure makes it easy for applications to be deployed on the target server.

Ii. Structure of ASP. NET Web applications

ASP.. NET applications are composed of various Web pages (. aspx and HTML files), processing programs, modules, Execution Code, and other files (such as sample files and configuration files) can all be referenced from the Web server's virtual directory. If you use. the CodeBehind mechanism of the aspx file, ASP. the. NET application also contains the compiled assembly and other Assembly supporting the application. For example, the application business logic can be encapsulated into a separate assembly. The Assembly is generally located in the bin subdirectory of the application virtual directory. To understand how VS. NET simplifies the deployment process, you must understand the assembly structure, because it is the structure characteristics of the Assembly that makes it possible to simplify the deployment. An Assembly contains four elements:

(1) MSIL code, that is, Microsoft intermediate language code: when compiling application code, the source code is compiled into the so-called MSIL code. MSIL code is the code that is understood by the. NET public Language Runtime Environment (CLR.

(2) Metadata: describes the types, methods, and other elements defined in the Code.

(3) Manifest: contains the name and version information, including the list of files, security information, and so on in the program.

(4) Supports files and resources.

From this structure, we can see that the Assembly contains complete self-description information, so VS. NET applications do not have to register in the registry as the COM component. That is to say, as long as the target machine is installed. NET Framework, install. NET applications simply copy the necessary files to the target machine. This is called XCOPY deployment. However, in addition to XCOPY, you can also use the "Web installation project" provided by VS. NET for automatic deployment. In the following content, we will see how to deploy a Web application using different deployment mechanisms.

Iii. deployment mechanism supported by ASP. NET

ASP. NET Web applications support the following three deployment solutions:

(1) XCOPY deployment

(2) Use the "Copy project" function of VS. NET to deploy

(3) Use VS. NET's "Web installation project" for deployment

In the following content, we will have a deep understanding of all the three deployment mechanisms. For ease of instruction, create a Visual C # ASP. NET Web application named DeploymentExampleWebApp, as shown in figure 1.



Figure 1

This project is used as an example to describe various methods for deploying Web applications.

4. Use the XCOPY command to deploy

One of the main goals of the. NET Framework is to simplify deployment, such as supporting XCOPY deployment. Before learning how. NET supports XCOPY deployment, let's take a look at what XCOPY deployment is like. Before. NET, installing a component (such as a COM component) means not only copying the component to an appropriate directory, but also performing operations such as registry modification. But now we have. NET. All operations to install a component are to copy the assembly to the bin directory of the customer application. Because the Assembly contains complete self-description information, the application can immediately start using the assembly. All of this is possible because the compiler embeds identifiers and metadata into the compiled module, and the CLR uses this information to load the appropriate version of the Assembly. The identifier contains all the information required to mount and run modules and find other modules referenced by the Assembly. This installation is also called Zero-Impact installation, because the system will not be affected by modifying the registry and configuring components. In addition, installation without interference will not affect the system. When you detach a component, you only need to delete some files from a specified directory.

During XCOPY deployment, you only need to open a command window and use the XCOPY command to copy necessary files to a specific directory on the server. Figure 2 shows how to use XCOPY to deploy a Web application named DeploymentExampleWebApp to the target server RemoteServer.



Figure 2



The XCOPY command has many options:

(1)/E: Copies the directories, subdirectories, and files in the source location to the target location, including empty directories.

(2)/K: Keep the attributes of all existing files and folders. By default, when copying a file or directory structure, the XCOPY command ignores the attributes of the file. For example, if the file originally has a read-only attribute, the read-only attribute is lost after it is copied to the target location. To retain the original file attributes, the/K option must be added.

(3)/R: overwrite files with read-only attributes.

(4)/O: Keep all security-related ACL permission settings for files or folders.

Others/H: The hidden files and system files must also be copied.

Upload/I: XCOPY is required to regard the target location as a directory. If the specified directory does not exist, create it.

After copying the folder to the target server, create a virtual directory on the target server using the IIS manager and map the virtual directory to the physical directory created by XCOPY. all operations required to deploy a Web application to a remote server.


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.