Weblogic Authors: Yeshim Deniz, Elizabeth White, Michael Meiner, Michael Bushong, Avi Rosenthal

Related Topics: Microsoft Cloud

Microsoft Cloud: Article

Tracing the Life of an HTTP Request:

HTTP request processing with IIS 6.0 and ASP.NET 1.1

The deep permeation of the World Wide Web into the life of the common man has lent itself to a variety of uses, most notably as a backbone for business-to-consumer (B2C) communication, creating a new business model called e-commerce. This article traces the lifetime of an HTTP request from its inception inside a Web browser to its interception by IIS 6.0, its processing by ASP.NET 1.1, and an HTTP response being sent back to the browser.

The Hypertext Transfer Protocol (HTTP) is the foundation of the Web. HTTP was invented by Tim Berners-Lee at the CERN Labs and is documented in RFC 2068 (www.w3.org/Protocols/rfc2068/rfc2068). HTTP is a request/response, text-based, stateless protocol used to communicate between a Web client (browser) and a Web server.

A typical Web interaction starts when the browser sends an HTTP request to the Web server. The Web server listens for requests, generally over TCP port 80. After receiving the request, the Web server identifies the resource associated with the request, processes application logic identified by that resource, and returns an HTTP response that may consist of text or binary data.

As you can see, this communication process requires only that the user have a browser to request a resource from a remote Web server. This zero-footprint install and the ability to access the remote resource from anywhere over the Internet are the two main factors in the success of this model.

IIS 6.0 is the latest offering from Microsoft in the Web server domain. Along with the application services provided by ASP.NET 1.1, it stakes a claim for the most reliable, scalable, secure, and manageable HTTP request processing engine available today.

A Simple HTTP Request/Response Dialog
Let us look at an example of a simple HTTP request/response dialogue. Suppose a file called ILoveHttp.htm is deployed in the root directory of your Web server and is made accessible via the URL http://www.example.org/ILoveHttp.htm.

The file contains some simple HTML:

<h1> I love HTTP! </h1>

Typing http://www.example.org/ ILoveHttp.htm in the address bar of the browser (in this case Internet Explorer 6.0) would generate an HTTP request that would look something like:

GET /ILoveHttp.htm HTTP 1.1
Accept: */*
Accept-Language: en-us
Connection: Keep-Alive
Host: www.example.org
User-Agent: Mozilla 4.0 (compatible;
MSIE 6.0; Windows NT 5.0)
Accept-Encoding: gzip, deflate

The first line of the request is called the request line, which includes the method (GET), the resource path (/ILoveHttp.htm), and the HTTP version (HTTP/1.1). After the request line come the header lines. The HTTP headers provide additional information required to process the request, such as the language and encoding supported by the Web browser. Notice the blank line after the headers. This line separates the headers from the body. This request does not have a body because it uses the GET method. A body is only appropriate if the request uses the POST method.

Assuming that ILoveHttp.htm was found inside the root directory of the Web server and it had the requisite read permissions, the response that the Web server sends would look something like:

HTTP/1.1 200 OK
Server: Microsoft-IIS/6.0
Date: Sun, 14 Jul 2003 06:45:23
Content-Length: 57
Content-Type: text/html
Cache-control: private
<h1> I love HTTP! </h1>

The first line of the response, called the status line, contains the HTTP version used for the response, the status code (200), and the reason phrase. After the status line come the header lines. The headers in the HTTP response provide additional information about the message like its MIME content type and its content length in bytes. The header lines are followed by an empty line, after which comes the body of the response.

You can find more about HTTP request and response header fields at Microsoft.

The Web Server: IIS 6.0
IIS 6.0 is an HTTP, SMTP, FTP, and NNTP server all in one. It is available on all editions of Windows 2003. In this article I will discuss only the Web server capabilities of IIS 6.0. As a Web server, IIS 6.0 enables quick and easy deployment of Web sites and provides the platform to build powerful Web applications using ASP.NET 1.1.

IIS 6.0 is capable of hosting multiple Web sites in a single installation. A Web site is a collection of Web applications and is uniquely identified by a host name, a port number, and a host header. A Web application is a collection of Web resources (text and binary files) that resides inside a virtual directory of a Web site. Figure 1 shows a high-level logical architecture of IIS 6.0.

Figure 1

The details of the various components are as follows.

HTTP.sys is the operating system's HTTP protocol stack and is implemented as a kernel mode component. It listens to requests, parses them, and then routes them to the appropriate request queue. Each request queue corresponds to a particular application pool.

Since no user code runs as part of HTTP.sys, it is isolated from any failure in application code. Even if a Web application crashes, HTTP.sys continues to receive and queue requests for that application, ensuring that the end user's experience is not interrupted. Also, since HTTP.sys runs as part of kernel code, it is very efficient.

After a request has been processed appropriately, HTTP.sys caches and returns the response to the Web browser.

Application Pools
An application pool is a logical grouping of Web applications hosted inside IIS 6.0. Each application pool can have zero or more Web applications in it. Each application pool serves one request queue maintained by HTTP.sys, as illustrated by the dashed arrows in Figure 1. Application pools can be created using the IIS Manager (inetmgr.exe).

Web Server Administration and Monitoring Component
The Web server administration and monitoring component (AKA Web service) is a user mode configuration and process manager that manages server operations and monitors the execution of application code. Like HTTP.sys, this component does not run any user code as part of itself, therefore remaining isolated from application failures.

This component (iisw3adm.dll) gets loaded as a nonshared service host process (svchost.exe). The services provided by the Web service are:

  • Configuration: During initialization, the Web service reads the inmemory copy of metabase.xml (the IIS 6.0 configuration file) and initializes HTTP.sys with the appropriate request/routing information.
  • Fault tolerance: If the Web service sees a failed application, it recycles and restarts the associated worker process automatically.
  • Worker process management: The user can configure when a worker process will be started, recycled, or restarted. This information can be configured using the IIS Manager.

    Worker Process
    Each application pool is serviced by one dedicated IIS 6.0 worker process (w3wp.exe) per processor. Having separate worker processes for separate application pools provides process isolation to the Web applications. This means that a malfunctioning Web application in an application pool has no effect on Web applications in other application pools.

    The worker process runs a Web core component (w3core.dll). This component is responsible for loading the ASP.NET runtime (aspnet_isapi.dll) in case the HTTP request happens to be for an ASP.NET resource.

    The worker process fetches requests directly from the kernel request queues maintained by HTTP.sys. This obviates the need for user-mode interprocess communication, making the fetch process very efficient.

    The worker process runs as a network service – a Windows account with bare minimum privileges.

    ASP.NET 1.1: The Application Server
    ASP.NET is an extensible Web programming model that works with IIS 6.0 and assists developers in producing dynamic Web applications. ASP.NET is installed when IIS 6.0 is configured as an application server.

    When IIS receives a request for an ASP.NET resource, it hands over the processing of the request to the ASP.NET ISAPI filter (aspnet_isapi. dll). The mapping of resource extensions to ISAPI filters can be configured using the IIS Manager. ASP.NET protects applications belonging to the same application pool from each other by processing each of them in separate AppDomains.

    After a request is handed over by IIS 6.0 to ASP.NET it is run through a sequence of events commonly referred to as the HTTP pipeline.

    The first thing that ASP.NET does after receiving a request is to instantiate an object of an undocumented type that inherits from the HttpWorkerRequest (System. Web.HttpWorkerRequest) abstract class. This object is initialized with information from the HTTP request.

    Next, an instance of the HttpRuntime (System.Web.HttpRuntime) class is created. This class is a singleton in the scope of the Web application; that is, only one instance of the class exists per application (or AppDomain). The HttpWorker Request object is then passed to the static ProcessRequest method of the HttpRuntime class. The HttpR untime class provides a set of runtime services to the ASP.NET applications.

    The ProcessRequest method of the HttpRuntime class carries out the following sequence of steps.
    1.  Create an instance of the HttpContext (System.Web.HttpContext) class. This object acts like a memento for the request. It stays with the request throughout its life inside the ASP.NET HTTP pipeline and request-specific information can be persisted within it. A partial (pun intended) definition of HttpContext is shown in Listing 1.

    Notice that the constructor of the HttpContext is passed the HttpWorkerRequest object.

    The constructor of HttpContext instantiates a bunch of useful objects of types like HttpRequest (System.Web.HttpRequest), HttpResponse (System. Web.HttpResponse), Http ServerUtililty (System.Web. HttpServerUtility), and HttpSessionState (System. Web.HttpSessionState), and then initializes them with the information available from the HttpWorkerRequest instance passed to it.

    2.  Next, the ProcessRequest method calls the static GetApplication Instance method of the Http ApplicationFactory (System. Web.HttpApplicationFactory) class to get an instance of HttpApplication (System.Web.HttpApplication).

    The runtime maintains a pool of HttpApplication objects. The GetApplicationInstance method either gets the HttpApplication object from this pool (if available) or instantiates a new one. The signature of the GetApplicationInstance method is:

    static IHttpHandler
    (HttpContext context);

    If the Web application has a global.asax file in its virtual directory the object returned by GetApplicationInstance is of a type derived from HttpApplication. This class extends the HttpApplication class by the code defined in global. asax.

    Now that the HttpApplication object has been created, it reads the machine-level configuration files (machine.config and web.config) and loads the modules required to pre- or postprocess the request. Modules are classes that implement the System.Web.IHttpModule interface, and are compiled and placed in the bin directory of the application. The section of configuration files that configures the modules looks like:

    <add name="OutputCache"
    <!— More like these ‡

    3.  Next, the ProcessRequest method calls the BeginProcessRequest (System.Web.IAsyncHandler.Be ginProcessRequest) method of the HttpApplication object. Using the information found in the <httpHandlers> section of the configuration files and the URL of the request, the BeginProcess Request method tries to locate the appropriate handler for the resource requested. The <httpHandlers> section of the configuration files, which maps URLs to handlers or handler factories, looks like that shown in Listing 2.

    In <httpHandlers> file extensions (or filenames) are mapped to either HTTP handlers (classes that implement the System.Web. IHttpHandler interface) or an HTTP handler factory (classes that implement the System. Web.IHttp Handler Factory interface). If the mapping is to an HTTP handler factory, the HttpApplication class uses the GetHandler method to get a handle to the HTTP handler.

    The HttpApplication class also fires a bunch of events like BeginRequest, Authenticate Request, and AuthorizeRequest. These events can be handled either in some of the HTTP modules or in global.asax.

    When the HttpApplication object charged with servicing a particular request invokes the GetHandler method on the System.Web.UI.PageHandler Factory, what it gets is an instance of a class derived from the Page (System.Web.UI.Page) class. The Page class implements the IHttpHandler interface. Next, the ProcessRequest (IHttpHand ler.ProcessRequest) method of the Page object is called. This method – which does the actual request processing – uses the page's Response property to access the HttpResponse object associated with the request. The Http Response object has several overloaded Write methods that give the Page object access to the response stream back to the browser. The Page object has access to the request's HttpContext object through its Context property.

    In this article I have shown you the framework that IIS 6.0 and ASP.NET 1.1 provide to process HTTP requests. I hope you enjoyed reading it.


  • Technical Overview of Internet Information Services (IIS) 6.0: www.microsoft.com/windowsserver2003/techinfo/overview/iis.mspx
  • Onion, F. (2003). Essential ASP.NET Programming. Addison-Wesley.
  • Esposito, D. (2003) Programming ASP.NET. Microsoft Press.
  • More Stories By Mujtaba Syed

    Mujtaba Syed works as a software architect with Marlabs Inc. He is an MCSD
    (early achiever) and loves to speak about and write on Microsoft .NET. Mujtaba has been programming the Microsoft .NET Framework since its beta 1 release. His current interests are focused on Longhorn.

    Comments (0)

    Share your thoughts on this story.

    Add your comment
    You must be signed in to add a comment. Sign-in | Register

    In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.

    @ThingsExpo Stories
    Recently, REAN Cloud built a digital concierge for a North Carolina hospital that had observed that most patient call button questions were repetitive. In addition, the paper-based process used to measure patient health metrics was laborious, not in real-time and sometimes error-prone. In their session at 21st Cloud Expo, Sean Finnerty, Executive Director, Practice Lead, Health Care & Life Science at REAN Cloud, and Dr. S.P.T. Krishnan, Principal Architect at REAN Cloud, will discuss how they bu...
    Coca-Cola’s Google powered digital signage system lays the groundwork for a more valuable connection between Coke and its customers. Digital signs pair software with high-resolution displays so that a message can be changed instantly based on what the operator wants to communicate or sell. In their Day 3 Keynote at 21st Cloud Expo, Greg Chambers, Global Group Director, Digital Innovation, Coca-Cola, and Vidya Nagarajan, a Senior Product Manager at Google, will discuss how from store operations...
    As hybrid cloud becomes the de-facto standard mode of operation for most enterprises, new challenges arise on how to efficiently and economically share data across environments. In his session at 21st Cloud Expo, Dr. Allon Cohen, VP of Product at Elastifile, will explore new techniques and best practices that help enterprise IT benefit from the advantages of hybrid cloud environments by enabling data availability for both legacy enterprise and cloud-native mission critical applications. By rev...
    Join IBM November 1 at 21st Cloud Expo at the Santa Clara Convention Center in Santa Clara, CA, and learn how IBM Watson can bring cognitive services and AI to intelligent, unmanned systems. Cognitive analysis impacts today’s systems with unparalleled ability that were previously available only to manned, back-end operations. Thanks to cloud processing, IBM Watson can bring cognitive services and AI to intelligent, unmanned systems. Imagine a robot vacuum that becomes your personal assistant tha...
    Nordstrom is transforming the way that they do business and the cloud is the key to enabling speed and hyper personalized customer experiences. In his session at 21st Cloud Expo, Ken Schow, VP of Engineering at Nordstrom, will discuss some of the key learnings and common pitfalls of large enterprises moving to the cloud. This includes strategies around choosing a cloud provider(s), architecture, and lessons learned. In addition, he’ll go over some of the best practices for structured team migrat...
    With major technology companies and startups seriously embracing Cloud strategies, now is the perfect time to attend 21st Cloud Expo October 31 - November 2, 2017, at the Santa Clara Convention Center, CA, and June 12-14, 2018, at the Javits Center in New York City, NY, and learn what is going on, contribute to the discussions, and ensure that your enterprise is on the right path to Digital Transformation.
    SYS-CON Events announced today that Datera will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Datera offers a radically new approach to data management, where innovative software makes data infrastructure invisible, elastic and able to perform at the highest level. It eliminates hardware lock-in and gives IT organizations the choice to source x86 server nodes, with business model option...
    Infoblox delivers Actionable Network Intelligence to enterprise, government, and service provider customers around the world. They are the industry leader in DNS, DHCP, and IP address management, the category known as DDI. We empower thousands of organizations to control and secure their networks from the core-enabling them to increase efficiency and visibility, improve customer service, and meet compliance requirements.
    Digital transformation is changing the face of business. The IDC predicts that enterprises will commit to a massive new scale of digital transformation, to stake out leadership positions in the "digital transformation economy." Accordingly, attendees at the upcoming Cloud Expo | @ThingsExpo at the Santa Clara Convention Center in Santa Clara, CA, Oct 31-Nov 2, will find fresh new content in a new track called Enterprise Cloud & Digital Transformation.
    SYS-CON Events announced today that N3N will exhibit at SYS-CON's @ThingsExpo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. N3N’s solutions increase the effectiveness of operations and control centers, increase the value of IoT investments, and facilitate real-time operational decision making. N3N enables operations teams with a four dimensional digital “big board” that consolidates real-time live video feeds alongside IoT sensor data a...
    SYS-CON Events announced today that NetApp has been named “Bronze Sponsor” of SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. NetApp is the data authority for hybrid cloud. NetApp provides a full range of hybrid cloud data services that simplify management of applications and data across cloud and on-premises environments to accelerate digital transformation. Together with their partners, NetApp emp...
    Smart cities have the potential to change our lives at so many levels for citizens: less pollution, reduced parking obstacles, better health, education and more energy savings. Real-time data streaming and the Internet of Things (IoT) possess the power to turn this vision into a reality. However, most organizations today are building their data infrastructure to focus solely on addressing immediate business needs vs. a platform capable of quickly adapting emerging technologies to address future ...
    SYS-CON Events announced today that Avere Systems, a leading provider of hybrid cloud enablement solutions, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Avere Systems was created by file systems experts determined to reinvent storage by changing the way enterprises thought about and bought storage resources. With decades of experience behind the company’s founders, Avere got its ...
    SYS-CON Events announced today that Avere Systems, a leading provider of enterprise storage for the hybrid cloud, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Avere delivers a more modern architectural approach to storage that doesn't require the overprovisioning of storage capacity to achieve performance, overspending on expensive storage media for inactive data or the overbui...
    SYS-CON Events announced today that IBM has been named “Diamond Sponsor” of SYS-CON's 21st Cloud Expo, which will take place on October 31 through November 2nd 2017 at the Santa Clara Convention Center in Santa Clara, California.
    SYS-CON Events announced today that Ryobi Systems will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Ryobi Systems Co., Ltd., as an information service company, specialized in business support for local governments and medical industry. We are challenging to achive the precision farming with AI. For more information, visit http:...
    High-velocity engineering teams are applying not only continuous delivery processes, but also lessons in experimentation from established leaders like Amazon, Netflix, and Facebook. These companies have made experimentation a foundation for their release processes, allowing them to try out major feature releases and redesigns within smaller groups before making them broadly available. In his session at 21st Cloud Expo, Brian Lucas, Senior Staff Engineer at Optimizely, will discuss how by using...
    In this strange new world where more and more power is drawn from business technology, companies are effectively straddling two paths on the road to innovation and transformation into digital enterprises. The first path is the heritage trail – with “legacy” technology forming the background. Here, extant technologies are transformed by core IT teams to provide more API-driven approaches. Legacy systems can restrict companies that are transitioning into digital enterprises. To truly become a lead...
    SYS-CON Events announced today that Daiya Industry will exhibit at the Japanese Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Ruby Development Inc. builds new services in short period of time and provides a continuous support of those services based on Ruby on Rails. For more information, please visit https://github.com/RubyDevInc.
    SYS-CON Events announced today that CAST Software will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CAST was founded more than 25 years ago to make the invisible visible. Built around the idea that even the best analytics on the market still leave blind spots for technical teams looking to deliver better software and prevent outages, CAST provides the software intelligence that matter ...