IIS schema and HTTP request processing process (1)

Source: Internet
Author: User

The principle of asp.net web programming

IIS schema and HTTP request processing process (1)


******************************************************************

Description

"ASP.net Web programming principles," including a series of articles, derived from the "ASP." NET program of programming, the 8th chapter of the ASP.net development of some of the more complex issues are introduced, the main purpose is to itcast on the election learned I teach the ASP. NET Technology Basics Course (HTTP://WWW.ITCAST.NET/PORTAL/COURSES/UNIT/137) provides students with more detailed learning materials. It is also available for other ASP.net developers to refer to.

This series of articles because of my textbook "ASP." NET programming course (Higher education publishing house is expected to be published in February 2009), therefore, users can be learning and reference for the purpose of distribution and dissemination, but not for commercial purposes, such as the use of its intact in other similar technical books.


Jin Xu-liang

September 27, 2008

*******************************************************************

 


IIS in the Windows operating system is responsible for providing internet services, and a computer running IIS can be viewed as a Web server.

The IIS major version number in Windows XP SP2 is 5,windows 2003 server is 6,vista and Windows Server 2008 is 7. For Windows 2003 Server, the default supported version of ASP.net is 1.1, so you must install the. NET Framework 2.0 above [1] separately.

Currently, IIS 6 is the most widely used version, IIS 5 is basically not deployed on a Web server, and IIS 6 is significantly different from IIS 5 in terms of system architecture, and IIS 7 has no fundamental changes in the infrastructure compared to IIS 6, but there are new enhancements and improvements in many areas. This book selects IIS 6/7 for introduction, and most of the content is also suitable for IIS 5, but some of the outdated features of IIS 5 are not covered.

First, let's distinguish three basic concepts that are easily confusing.

8.1.1 Web sites, Web applications, and virtual directories

In IIS, you can create Web sites, Web applications, and virtual directories to share information with users on your computer network. The relationship between the three concepts of Web site, Web application, and virtual directory is shown in Figure 8‑1.




<?xml:namespace prefix = o/>

<?xml:namespace prefix = v/>

Figure 8‑1 Web site, application and virtual directory

In short, a Web site contains one or more Web applications (Web application), one Web application contains one or more virtual directories, and the virtual directory maps to The physical directory on the WEB server or remote computer.

Figure 8‑2 shows a Web server running IIS 7.



Figure 8‑2 Web sites, applications, and virtual directories in IIS 7

You can see clearly in figure 8‑2 that there are two sites on this Web server: Default Web site and Newwebsite, where the default Web site has three Web applications: Happybookshopservice, Happybookshopwebsite and Onlinealbum. Each subfolder under the Happybookshopwebsite application is a "virtual directory." The top-level virtual directory is called the root virtual directory, and the root virtual directory of the Web application Happybookshopwebsite in Figure 8‑2 is "/happybookshopwebsite".

The following three concepts are dissected individually. 1 website (web site)

A Web site is a container for Web applications, each with a unique identity, which is a combination of its IP address, port, and optional main header/host name . The Web server determines which Web site is requested based on the information in the HTTP request received.

In IIS 7, the site identity is referred to as a site binding , as shown in the Site Bindings dialog box for the default Web site for IIS 7, 8‑3.



Figure 8‑3 Web site binding 2 Web application (Web application) in IIS7.0

A WEB application is a software program that runs in the application pool (application pool) [3] and provides information services (usually in HTML format) to users through the HTTP protocol. When you create a Web application, the name of the Web application becomes part of the Web site URL, and users can emit HTTP requests for that URL through a Web browser.

ASP, created by using Visual Studio. NET Web site, which is actually a Web application, does not equal the "Web site" in IIS.

In IIS, each Web site must have at least one Web application (but not necessarily a asp.net application, which can be another type of Web application), which is called the root Web application or the default Web application, the site can also contain one or more asp.net (or other kinds) of Web applications.

In Windows XP SP2, a asp.net Web site created using Visual Studio is published to native IIS and is run as a Web application hosted by the native Default Web site, which is the web site that "localhost" represents.

Windows server and Vista can create a separate IIS Web site for a asp.net application that only hosts this unique asp.net application and runs in a separate application pool. Many commercial web sites use this approach to achieve higher performance while isolating this site from other sites hosted on the Web server to enhance the security of the Web server. 3 Virtual Directory


A virtual directory is a directory name that is specified in IIS and mapped to a physical directory on a local or remote server. The virtual directory name will then become part of the Web application URL that allows users to request access to the resource in the physical directory corresponding to this URL through a Web browser.

In IIS, each WEB application must have a top-level virtual directory, which is called the root virtual directory .

In Visual Studio, you can set the root "virtual path" (Figure 8‑4) of the ASP.net Web site directly in the Properties window.



Figure 8‑4 ASP. NET Web site's virtual path

Note, however, that the "virtual path" Set here is the virtual path of the lightweight Web server "asp.net Development server" that Visual Studio brings, not the virtual path in IIS. If you use the full version of Visual Studio (such as a team development version), you can use a Publish Web site feature. When you publish a Web site using this feature, you can directly specify the root virtual directory diagram 8‑5 that the ASP.net application corresponds to in IIS.



Figure 8‑5 Setting the root virtual directory of the ASP.net Web site in IIS

Figure 8‑5 Sets the IIS root virtual directory for the ASP.net web site to mynewwebsite.

A Web application can have multiple virtual directories that will become subdirectories of the Web application root virtual directory.

It is easy to create a virtual directory in IIS (Figure 8‑6).



Figure 8‑6 Create a virtual directory in IIS 7

After you add a virtual directory to a Web application, you can access the Web pages in the virtual directory through the following URL

http://site name/web application root virtual directory/newly created child virtual directory/web page name

In the example above, the Web application root virtual directory is "/mynewwebsite", and the newly added virtual directory is "Mynewvirtualdir", which points to the "D:/mydir" directory. Assuming that there is a ASP.net page in the D:/mydir directory (which may be set to sample.aspx), you can access this page through the following URL:

Http://localhost/MyNewWebSite/MyNewVirtualDir/Sample.aspx

[1] It is recommended that you install the latest version of the. NET Framework on Windows 2003 server to support new technologies, such as Ajax and Silverlight. [2] More specifically, it is a system core component of Windows Server: HTTP. SYS is responsible for this work. HTTP is also described later in the introduction of the IIS schema. SYS component.

[3] The application pool is described in more detail later in this article

[4] "virtual directories" are sometimes referred to as "virtual paths", both of which represent the same concept.

[5] for the Visual Web Developer Express Edition, it does not provide the ability to publish Web sites, but you can do so by finding the appropriate button in the Copy Web Site dialog window. Or, more directly, use IIS Manager to do this work.

 [6] uses the Virtual Directory Creation Wizard in IIS 5/6 to create a virtual directory by right-clicking on one of the Web application nodes of IIS and selecting new--> Virtual Directory from the shortcut menu. The operation of IIS 7 is similar, but it provides the "Add virtual directory" command directly in the first level of the shortcut menu.

(see Part Two: http://blog.csdn.net/bitfan/archive/2008/09/28/2990606.aspx)

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.