Three major technologies for deploying ASP.net (i) (1)

Source: Internet
Author: User
Tags new features visual studio
asp.net outline:

I. Overview

II. the structure of asp.net Web applications

Third, ASP. NET-supported deployment mechanisms

Iv. Deployment with xcopy command

V. Deploy with the Vs.net "Copy Project" feature

Vi. deployment with Web installation projects

6.1 Windows Installer

Features of the 6.2 Vs.net Web Setup Project

Vii. Creating a Web Setup Project

Eight, install ASP.net Web application

Ix. concluding remarks

Body:

I. Overview

It is essential to understand the differences between configuration (Setup) and Deployment (deployment) before delving into the specific steps for configuring and deploying ASP.net Web applications. Configuration refers to packaging applications in a form that is easy to deploy, and packaged applications can be easily installed on the target server. A deployment is a process that obtains an application and installs it on another machine, typically through an installer.

Many users have been confronted with the vulnerability of Windows Software installation technology--When we install a new version of a software, the installer copies the new version of the DLL file to the system directory while performing all the necessary registry modifications, but the installation operation may affect other software running on the same machine. Especially when the original software and the newly installed software share a component, there is a greater likelihood of problems. If the newly installed component is backward compatible with its earlier version, but in many cases it is difficult to fully maintain backward compatibility, it is often the case that the original software is corrupted after installing a new software, which is the notorious DLL hell problem.

One of the design goals of Visual Studio.NET (Vs.net) is to troubleshoot problems that you often encounter when you install Windows software. Vs. NET applications rely on the. NET Framework class library implementation, the. NET Framework class library establishes a new programming model that creates the conditions for greatly simplifying the installation process. In addition, VS. NET application is compiled into an assembly (Assembly), which is a deployment unit that consists of one or more files that are running on the supporting assembly. Microsoft. NET Framework introduces a number of new features that simplify application deployment and solve DLL hell issues, such as Configuration information can be saved in the Web.config configuration file, which is an XML-formatted text file that can be replicated and deployed directly to the target server using commands such as Xcopy.

Before exploring the various deployment mechanisms, let's take a look at the structure of the ASP.net application, because it is the structure that makes the application easy to deploy to the target server.

II. the structure of asp.net Web applications

Asp. NET applications consist of various Web pages (. aspx and HTML files), handlers, modules, execution code, and other files (such as graphics files, profiles, and so on) that can be referenced from the Web server's virtual directory. If you use the codebehind mechanism of the. aspx file, the ASP.net application also contains compiled assemblies, as well as other assemblies that support the application, for example, you can encapsulate the application's business logic into a separate assembly. Assemblies are typically located in the bin subdirectory of the application's virtual directory. To understand how vs.net simplifies the deployment process, you must understand the structure of the Assembly, because it is the structural nature of the assembly that makes it possible to simplify deployment. An assembly consists of four elements:

⑴msil code, the Microsoft intermediate Language code: When compiling the application code, the source code is compiled into so-called MSIL code. MSIL code is code understood by the. NET Common language runtime Environment (CLR).

⑵ metadata: Describes the types, methods, and other elements defined in the code.

⑶manifest: Contains name and version information, the assembly contains a list of files, security information, and so on.

⑷ support files and resources.

As you can see from this structure, the assembly contains complete self-describing information, so the vs.net application does not have to register in the registry like a COM component. This means that as long as the target machine is installed. NET Framework, it is OK to simply copy the necessary files to the target machine when installing the Vs.net application, which is known as XCOPY deployment. However, in addition to Xcopy, you can use the Web Setup project provided by vs.net to implement automatic deployment. In the next section, we'll see how to deploy a Web application with various deployment mechanisms.

Third, ASP. NET-supported deployment mechanisms

The ASP.net Web application supports the following three deployment scenarios:

⑴xcopy deployment

⑵ uses the Vs.net replication project feature to deploy

⑶ using Vs.net's Web Setup project deployment

In the next section, we'll look at all three deployment mechanisms in depth. For illustration purposes, we first create a Visual C # asp.net Web application with the name Deploymentexamplewebapp, as shown in Figure I.



Figure I

We will take this project as an example to illustrate the various ways to deploy Web applications.

Iv. Deployment with xcopy command

. NET Framework is one of the primary goals of simplifying deployment, such as enabling Xcopy deployments. In understanding. NET how to support Xcopy deployment, let's take a look at what the Xcopy deployment is all about. Before. NET, installing a component, such as a COM component, means not only copying components to the appropriate directory, but also performing operations such as registry modifications. But now that you have. NET, the whole operation of installing a component is to copy the assembly to the client application's Bin directory, and the application can start using the assembly immediately because the assembly contains complete self-describing information. This is possible because the compiler embeds identifiers and metadata information into the compiled module, and the CLR uses that information to mount the appropriate version of the Assembly. The identifier contains all the information needed to load and run the module and find other modules referenced by the assembly. This installation is also known as a zero-impact installation, because the system is not affected by modifying the registry, configuring components, and without interfering with the installation of the component, which does not have any unintended effect on the system, as long as you remove some files from a specific directory when uninstalling the component.

When you perform XCOPY deployment, the only thing you need to do is open a command window and use the Xcopy command to copy the necessary files to a specific directory on the server. Figure II shows how to use XCOPY deployment to deploy a Web application named Deploymentexamplewebapp to the target server remoteserver.



Figure II

As you can see, the xcopy command has many options:

⑴/E: Indicates that directories, subdirectories, and files from the source location are copied to the target location, including an empty directory.

⑵/k: Preserves the properties of all existing files and folders. By default, the Xcopy command ignores the properties of a file when copying a file or directory structure, for example, if the file originally had a read-only property, the read-only property was lost after it was copied to the target location. To preserve the original file properties, you must add the/k option.

⑶/R: Overwrites files with read-only properties.

⑷/O: Preserves all security-related ACL permission settings for a file or folder.

⑸/h: Hidden files and system files are also copied.

⑹/i: xcopy is required to treat the target location as a directory, if the specified directory does not exist, create it.

After you copy the folder to the target server, create a virtual directory on the target server with IIS Manager, map the virtual directory to the physical directory created by Xcopy--that's all you have to do to deploy an asp.net Web application to a remote server using Xcopy.

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.