http://msdn.microsoft.com/en-us/library/ms524901(v=vs.90).aspx

http://msdn.microsoft.com/en-us/magazine/cc188942.aspx

http://blogs.iis.net/tomwoolums/archive/2008/12/16/iis-7-0-http-request-processing.aspx

http://theprofessionalspoint.blogspot.com/2012/04/how-iis-processes-aspnet-request.html

http://myaspnetraman.blogspot.com/2012/01/how-iis-process-aspnet-request.html

http://ppandey07.wordpress.com/2013/10/31/how-iis-process-asp-net-request-works/

http://www.dotnetfunda.com/articles/show/821/beginners-guide-how-iis-process-aspnet-request

This article describes how the IIS process clients requests and responses.

Introduction

When request come from client to the server a lot of operation is performed before sending response to the client. This is all about how IIS Process the request.  Here I am not going to describe the Page Life Cycle and there events, this article is all about the operation of IIS Level.  Before we start with the actual details, let’s start from the beginning so that each and everyone understand it's details easily.  Please provide your valuable feedback and suggestion to improve this article.

What is Web Server ?

When we run our ASP.NET Web Application from visual studio IDE, VS Integrated ASP.NET Engine is responsible to execute all kind of asp.net requests and responses.  The process name is "WebDev.WebServer.Exe" which actually takw care of all request and response of an web application which is running from Visual Studio IDE.

Now, the name “Web Server” come into picture when we want to host the application on a centralized location and wanted to access from many locations. Web server is responsible for handle all the requests that are coming from clients, process them and provide the responses.

What is IIS ?

IIS (Internet Information Server) is one of the most powerful web servers from Microsoft that is used to host your ASP.NET Web application. IIS has it's own ASP.NET Process Engine  to handle the ASP.NET request. So, when a request comes from client to server, IIS takes that request and  process it and send response back to clients.

Request Processing :

Hope, till now it’s clear to you that what is Web server and IIS is and what is the use of them. Now let’s have a look how they do things internally. Before we move ahead, you have to know about two main concepts

1.    Worker Process
2.    Application Pool

Worker Process:  Worker Process (w3wp.exe) runs the ASP.Net application in IIS. This process is responsible to manage all the request and response that are coming from client system.  All the ASP.Net functionality runs under the scope of worker process.  When a request comes to the server from a client worker process is responsible to generate the request and response. In a single word we can say worker process is the heart of ASP.NET Web Application which runs on IIS.

Application Pool:  Application pool is the container of worker process.  Application pools is used to separate sets of IIS worker processes that share the same configuration.  Application pools enables a better security, reliability, and availability for any web application.  The worker process serves as the process boundary that separates each application pool so that when one worker process or application is having an issue or recycles, other applications or worker processes are not affected. This makes sure that a particular web application doesn't not impact other web application as they they are configured into different application pools.

Application Pool with multiple worker process is called “Web Garden”.

Now, I have covered all the basic stuff like Web server, Application Pool, Worker process. Now let’s have look how IIS process the request when a new request comes up from client.

If we look into the IIS 6.0 Architecture, we can divided them into Two Layer

1.    Kernel Mode
2.    User Mode

Now, Kernel mode is introduced with IIS 6.0, which contains the HTTP.SYS.  So whenever a request comes from Client to Server, it will hit HTTP.SYS First.

Now, HTTP.SYS is Responsible for pass the request to particular Application pool. Now here is one questionHow HTTP.SYS comes to know where to send the request?  This is not a random pickup. Whenever we creates a new Application Pool, the ID of the Application Pool is being generated and it’s registered with the HTTP.SYS. So whenever HTTP.SYS Received the request from any web application, it checks for the Application Pool and based on the application pool it send the request.

So, this was the first steps of IIS Request Processing.

Till now, Client Requested for some information and request came to the Kernel level of IIS means at HTTP.SYS. HTTP.SYS has been identified the name of the application pool where to send. Now, let’s see how this request moves from HTTP.SYS to Application Pool.

In User Level of IIS, we have Web Admin Services (WAS) which takes the request from HTTP.SYS and pass it to the respective application pool.

When Application pool receive the request, it simply pass the request to worker process (w3wp.exe) . The worker process “w3wp.exe” looks up the URL of the request in order to load the correct ISAPI extension. ISAPI extensions are the IIS way to handle requests for different resources. Once ASP.NET is installed, it installs its own ISAPI extension (aspnet_isapi.dll) and adds the mapping into IIS.

Note : Sometimes if we install IIS after installing asp.net, we need to register the extension with IIS usingaspnet_regiis command.

When Worker process loads the aspnet_isapi.dll, it start an HTTPRuntime, which is the entry point of an application.HTTPRuntime is a class which calls the ProcessRequest method to start Processing.

When this methods called, a new instance of HTTPContext is been created.  Which is accessible usingHTTPContext.Current  Properties. This object still remains alive during life time of object request.  Using HttpContext.Current we can access some other objects like Request, Response, Session etc.

After that HttpRuntime load an HttpApplication object with the help of  HttpApplicationFactory class.. Each and every request should pass through the corresponding HTTPModule to reach to HTTPHandler, this list of module are configured by the HTTPApplication.

Now, the concept comes called “HTTPPipeline”. It is called a pipeline because it contains a set of HttpModules ( For Both Web.config and Machine.config level) that intercept the request on its way to the HttpHandler. HTTPModules are classes that have access to the incoming request. We can also create our own HTTPModule if we need to handle anything during upcoming request and response.

HTTP Handlers are the endpoints in the HTTP pipeline. All request that are passing through the HTTPModule should reached to HTTPHandler.  Then  HTTP Handler  generates the output for the requested resource. So, when we requesting for any aspx web pages,   it returns the corresponding HTML output.

All the request now passes from  httpModule to  respective HTTPHandler then method and the ASP.NET Page life cycle starts.  This ends the IIS Request processing and start the ASP.NET Page Lifecycle.

Conclusion

When client request for some information from a web server, request first reaches to HTTP.SYS of IIS. HTTP.SYS then send the request to respective  Application Pool. Application Pool then forward the request to worker process to load the ISAPI Extension which will create an HTTPRuntime Object to Process the request via HTTPModule and HTTPHanlder. After that the ASP.NET Page LifeCycle events starts.

This was just overview of IIS Request Processing to let Beginner’s know how the request get processed in backend.  If you want to learn in details please check the link for Reference and further Study section.

Reference and Further Study

A low-level Look at the ASP.NET Architecture
IIS Architecture

bing---iis how to process http request的更多相关文章

  1. 在win 7 vs2013下 web 调试 出现“ iis Express Worker Process 已停止工作”错误

    在win 7 vs2013下 web 调试 出现“ iis Express Worker Process 已停止工作”错误: 如下图:   最终解决方案如下: 用管理员身份运行CMD,输入netsh  ...

  2. WebHost failed to process a request.Memory gates checking failed because the free memory (140656640 bytes) is less than 5% of total memory

    WebHost failed to process a request. Sender Information: System.ServiceModel.ServiceHostingEnvironme ...

  3. Windows下应用级别的IIS负载均衡方案 Application Request Route

    转载于:https://blog.csdn.net/2000killer/article/details/51228625 序言 随着公司业务的发展,后台业务就变的越来越多,然而服务器的故障又像月经一 ...

  4. Salesforce Integration 概览(二) Remote Process Invocation—Request and Reply(远程进程调用--请求和响应)

    本篇参考:https://resources.docs.salesforce.com/sfdc/pdf/integration_patterns_and_practices.pdf 我们在项目中,经常 ...

  5. iis 反向代理 组件 Application Request Route

    安装后要重启服务器. 不然 IIS 不会生效.

  6. VS2013调试时,IIS Express Worker Process 已停止工作

    之前调试都没有报错的,今天突然报错了,然后网上找了下资料,很快解决了问题 这是我报错的提示 解决办法: 用管理员身份运行CMD,输入netsh winsock reset并回车(注意,必须是已管理员身 ...

  7. iis express worker process已停止工作

    以管理员方式运行命令提示符工具,然后执行以下语句 netsh winsock reset 重启电脑

  8. 【已解决】前端到后端400错误(The server cannot or will not process the request due to...)

    看到400错误,一般是请求无效.出现该异常一般有三种情况: 第一种情况: 前端提交的内容在后端一般都用String类型来接收,用Date类型接收会报错. 第二种情况: 在提交表单的时候,填写的数据类型 ...

  9. 错误信息: The server cannot or will not process the request due to something that is perceived to be a client error

    错误原因:在提交的表单中有 date 类型的数据,也就是不能传输日期类型的数据. 嗯!我知道,去吧!

随机推荐

  1. 批量更新数据小心SQL触发器的陷阱

    批量更新数据时候,Inserted和Deleted临时表也是批量的,但触发器只会调用执行一次!两个概念千万不要弄混淆! 错误的理解:例如:创建在A表上创建了一个Update触发器,里面写的是Updat ...

  2. 美丽的表格样式(使用CSS样式表控制表格样式)

    按照WEB2.0风格,设计了几个表格样式,希望大家喜欢. WEB2.0提倡使用div开布局,但不是要全然放弃使用表格,表格在数据展现方面还是不错的选择. 如今使用介绍使用CSS样式表来控制.美化表格的 ...

  3. [PWA] 14. Loop cursor

    import idb from 'idb'; var dbPromise = idb.open('test-db', 4, function (upgradeDb) { switch (upgrade ...

  4. [Javascript] Automating Releases with semantic-release

    There are so many repeated steps when releasing a new version of a library. The tool semantic-releas ...

  5. oracle暂时表空间 ORA-01652:无法通过16(在表空间XXX中)扩展 temp 字段

    今天在查数据的时候报错  ORA-01652:无法通过16(在表空间temp1中)扩展 temp 字段 查看表空间使用明细 SELECT b.tablespace,        b.segfile# ...

  6. debian7 安装配置

    最近几天折腾了一下Debian 7 (gnome桌面DVD版,KDE桌面CD版最后会提到),总的来说收获还是挺大的,对比以前使用ubuntu,debian 7给我的感觉像是一个新生婴儿,不带多余的花俏 ...

  7. 网络接口 使用NSURLConnection完成Get和Post方法

    网络接口 使用NSURLConnection完成Get和Post方法 什么是URL: URL就是统一资源定位器(UniformResourceLocator:URL).通俗地说,它是用来指出某一项信息 ...

  8. url编码解码-js编码、C#编码

    JS编码解码 函数一定义和用法encodeURI() 函数可把字符串作为 URI 进行编码. 语法 encodeURI(URIstring) 参数 描述 URIstring 必需.一个字符串,含有 U ...

  9. Referenced file contains errors (http://tiles.apache.org/dtds/tiles-config_3_0.dtd)

    java开发时遇到的问题,之前还是好好的,没有错误提示.可是今天一打开项目就出现这种问题.真不知道是怎么回事,在这里求助.错误如下: Referenced file contains errors ( ...

  10. 使用MiniProfiler调试Asp.net Mvc性能

    使用nuget添加MiniProfiler.EF组件 在Global文件中配置MiniProfiler protected void Application_Start() { AreaRegistr ...