Deploy three major ASP. NET technologies (I) (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.