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 for executing all kind of asp.net requests and responses. The process name is “WebDev.WebServer.Exe” which takes care of all request and response of a web application which is running from Visual Studio IDE.
Now, the name “Web Server” comes into picture when we want to host the application on a centralized location and wanted to access from many places. 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 Services) is one of the most powerful web servers from Microsoft that is used to host your ASP.NET Web application. IIS has its 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 the response back to clients.
Request Processing :
Hope, till now it’s clear to you that what is the 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 for managing all the request and response that are coming from the client system. All the ASP.Net functionality runs under the scope of the worker process. When a request comes to the server from a client worker process is responsible for generating 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 the worker process. Application pools are used to separate sets of IIS worker processes that share the same configuration. Application pools enable 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 impact other web application as they are configured into different application pools.
Application Pool with multiple worker processes is called “Web Garden.”
Now, I have covered all the basic stuff like the Web server, Application Pool, Worker process. Now let’s have a look how IIS process the request when a new request comes up from a client.
If we look into the IIS 6.0 Architecture, we can divide 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 the particular Application pool. Now here is one question, How HTTP.SYS does come to know where to send the request? This is not a random pickup. Whenever we create 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 checked for the Application Pool and based on the application pool it sends 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 receives the request, it just passes the request to worker process (w3wp.exe). The worker process “w3wp.exe” looks up the URL of the request 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 using an aspnet_regiis command.
When Worker process loads the aspnet_isapi.dll, it starts an HTTPRuntime, which is the entry point of an application. HTTPRuntime is a class which calls the ProcessRequest method to start Processing.
When this method called, a new instance of HTTPContext is created. Which is accessible using HTTPContext.Current Properties. This object remains alive during the 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. Every request should pass through the corresponding HTTPModule to reach to HTTPHandler, this list of a module is 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 HTTPModule if we need to handle anything during upcoming request and response.
HTTP Handlers are the endpoints in the HTTP pipeline. All request that is passing through the HTTPModule should reach to HTTPHandler. The HTTP Handler generates the output for the requested resource. So, when we were requesting for any aspx web pages, it returns the corresponding HTML output.
All the request now passes from httpModule to respective HTTPHandler then the method and the ASP.NET Page life cycle starts. This ends the IIS Request processing and starts the ASP.NET Page Lifecycle.
Conclusion
When the client request for some information from a web server, request first reaches to HTTP.SYS of IIS. HTTP.SYS then send the request to particular Application Pool. Application Pool then forwards the request to worker process to load the ISAPI Extension which will create an HTTPRuntime Object to Process the request via HTTPModule and HTTP handler. After that, the ASP.NET Page LifeCycle events start.
This was a just overview of IIS Request Processing to let Beginner’s know how the request gets processed in the backend. If you want to learn about 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
Please share your suggestion and feedback.
This is good article and Thannks very much
LikeLike
very good article…..
LikeLike
very nice article
LikeLike
Dear Abhijit,
Thank you for the great article. I must accept that I learnt something new about IIS request processing from this article that I didn’t know earlier.
Awesome article!
Keep it up and take care.
Regards,
Sheo Narayan
LikeLike
Thank you so much Sheo !!
LikeLike
Yor are the MANNNNNNNNNNNNNN
LikeLike
Great Article Sir. There were lot of new stuff, I came to know through this.
I would like to know, how you create these *sexy* workflow diagrams. I mean which software you use?
LikeLike
Thanks | Thats are done by MS Powerpoint only !!!
LikeLike
Hi Abhijit,
Really this is very good articles. It helps a lot for beginers.
Appreciate for your efforts and sharing the knowledge to dotnet community.
I know personally, how much hard to prepare the documents.
Regards,
Ramesh Babu
LikeLike
Thanks Ramesh !!
LikeLike
Good information. Thanks for sharing.
LikeLike
Hi! Congratulations! All good devellopers should know about this.
Thank you so much.
LikeLike
Thanks !
LikeLike
Thanks Abhijeet,
It is very nice article. It is really helpful for understanding the IIS level request processing.
Regards,
Pravin Shimpi
LikeLike
Really good article…easy way out to explain iis request/response flow..very simplified way to communicate..Thanks
LikeLike
Very informative!! Continue writing article like this that covers the basics!!
LikeLike
Nice article
Abhijit I would like to see video for the same article.
if it is possible please reply me on my emailid
LikeLike
No, I don’t have any video for that. Recently I have presented a session at Microsoft User group Hyderabad on same topic in bit details, check here
https://abhijitjana.net/2011/02/27/download-ppt-asp-net-request-processing-internals-microsoft-user-group-hyderabad-community-meet-26-feb-2011/
LikeLike
thanks for the wonderful article please go on still hungry to learn and learn forever
LikeLike
Great Man, nice catch
LikeLike
thanks sir for this rich source of knowledge, it is really a beneficial for all.
LikeLike
It is good and very easy way to present this topic.It is very helpful for the begineers.
LikeLike
Awesome article!!!
Nothing more we can ask from the author Abhijit about ASP.net IIS cycle.
LikeLike
It’s very great absolutely clear, thanks Abhijit.
LikeLike
Hi Abhijit,
This was really very Good. I was really afraid about IIS because it was something which I didn’t understand ever but this time I got a good way of understanding it.
Thanks for writing this Awesome article.
Thanks,
LikeLike
Hi Abhijit,
This was really very Good. I was really afraid about IIS because it was something which I didn’t understand ever but this time I got a good way of understanding it.
Thanks for writing this Awesome article.
Thanks,
LikeLike
Awesome article……Its so informative and very good for beginners to learn without any confusion…..just follow it step by step……….I ll suggest it to my friends………..Thanks for the article one again…..
LikeLike
Excellent Explanation…
LikeLike
Great article !! Keep it up 🙂
LikeLike
This is really nice document. Thanks.
LikeLike
really great article it helps me lot
LikeLike
Really nice article…It helped me a lot to learn about ASP.Net request processing.
LikeLike
really awesome man…until now i dnt have a clear idea about this.. thanks a lot
LikeLike
I am very late to comment but this article is really great.
seems like it made my day!!
Praveen
LikeLike
Really a nice artical for all, excellent learning for beginners and refreshment for experts 🙂
Thanks Abhijit.
LikeLike
Sir this article is more helpful to me to understanding how the asp.net application life cycle……
It is awesome article with graphical figures…..
Please write this type of articles………
Thank u
srinubabu.ravilla@gmail.com
LikeLike
excellent article! it explains the concept in a very simple way.. easy to understand! thanks!
LikeLike
A very nice article abhijeet..thank you very much
LikeLike
Really so good. Thanks for this wonderful articles. In my language boole to mast wala
LikeLike
good one
LikeLike
Its great one & very helpfull.
LikeLike
Hi,
Its very good article for who are working on asp.net with IIs
LikeLike
easy to understand.
really very good and helpful.
Keep post this kind of articles.
LikeLike
nice artical and easy to understand.
keep post more articals in .net
LikeLike
really a very good article … Thanks a lot..
LikeLike
very easy and simple for the beginners.
LikeLike
i like it very much …you explained very wel
LikeLike
as a beginner its sooo simple to understand with this explanation
LikeLike
This is an ultimate explanation one can give on asp.net life cycle …..ULTIMATE..superb explanation..Hats off to U..:) ..I am lucky dat i got to read this article..Ever after reading soo many other articles i still had one or the other doubt running in my mind..But after reading yo article..Thanks to U..u cleared all my doubts..I am very very Happy today for i was longing for this kinda explanation..Thank U soo much once again..Keep writing such awesome articles..:)WISH U ALL GOOD LUCK..
LikeLike
Hi Manasa,
Great to see you liked it. Just to update you, I am going to speak on “Inside IIS Request Processing and ASP.NET Page Life Cycle” , on this Virtual Tech Days, 15th Dec.
I will be talking some more interesting stuff on this
you can register here for the same
http://www.virtualtechdays.com
LikeLike
Thanks Abhijit Jana.
You are rock.. Thanks for sharing (Web Application internal process) to everybody.
LikeLike
Gr8 Article..You know what a user wants to read..such a nice effort.
Keep going on.
LikeLike
Really its awesome article ….:)
LikeLike
Really very good article… Thanks Abhijit..
LikeLike
Really a very good article… Thanks Abhijit..
LikeLike
I LIKED THE ARTICLE VERY MUCH. ALL CONCEPTS ARE EXPLAINED IN VERY SIMPLE MANNER FOR A BEGINNER ALSO TO UNDERSTAND CONCEPTS WELL. IT HELPED ME A LOT TO CLEAR MY CONCEPTS.
LikeLike
excellent article! it explains the concept in a very simple way.. easy to understand! thanks!
LikeLike
Hi Abhijit,
This is really a good article of HTTP request pipeline. But i have one question… WAS is really stand on Web Admin Services(WAS) or Windows Process Activation Service (WAS)? Can you clear me.
LikeLike
Govind, that should be Windows Process Activation Service (WAS) . I will update the article along with my latest talk on In-depth of IIS Request processing.
You can check it here http://www.microsoft.com/en-in/showcase/details.aspx?uuid=11183b99-146d-4a57-9481-98a815691579
LikeLike
Thanks Abhijeet,
It is very nice article. It is really helpful for understanding the IIS level request processing.
Regards,
Arindam M
LikeLike
Very nice article for beginners..Keep writing:)
LikeLike
HI Abhijit,
Its really a wonderful article. Thanks a lot.
It wud be really great, if you can give me more clear understanding on Application Pool and Worker process. Actually my biggest confusion in .net is on the working of Worker process. and the architecture of application pool aaplication domain, worker process and threads 😦 can you explain it a bit, it wud be reallt helpful.
Thanks a lot
LikeLike
Hi Veenu,
Check out my webcast on the same here. It has details discussion. http://www.microsoft.com/en-in/showcase/details.aspx?uuid=11183b99-146d-4a57-9481-98a815691579
LikeLike
Excellent one…
LikeLike
Great job abhit…you are .NET DON…nd great TRAINER skills….
LikeLike
Very nice Article from this author.Nice Work man…..Keep this…..
LikeLike
Nice article for all level developers…..Thanks u man….
LikeLike
Thanks Abhijit, This is a realy very good article I have ever read for IIS and ASP.NET relation.
LikeLike
Very informative article. i also like the diagrams which actually helps user to absorb so big article quickly.
LikeLike
Thanks a lot for this extremely informative and interesting article, Abhijit. You have certainly explained the concept in a very simple way which is easily understood.
LikeLike
nice article, thanks
LikeLike
Very nice article.Thanks a lot for such a nice effort..keep it up.
LikeLike
Very nice article……..
LikeLike
Can u please explain how URL routing is process in IIS server.
LikeLike
Gud article. veri nicely explained
LikeLike
one to the best article i have ever read about asp.net request pipe line.
LikeLike
Great article. Thanks Alot.
LikeLike
This is good Article of iis process.
Thanks you
LikeLike
Really Great Article. Thanks
LikeLike
very good article ..very informative..
LikeLike
Hi Abhijit ur very smart…….Thanks
LikeLike
good one 🙂
LikeLike
Very nice article, thanks a lot 🙂
LikeLike
really great article it helps me lot
LikeLike
thanks sir it’s a very usefull artical
LikeLike
A wonderful and awesome article, helps more than a lot to understand the whole process, great job sir!
LikeLike
Superb..Very good article
LikeLike
nice yar
LikeLike
thanks for giving me awesome article
LikeLike
These are really wonderful ideas in about blogging. You have touched some good factors here.
Any way keep up wrinting.
LikeLike
Excellent……Just started ASP.Net and going through an article like this has already reduced lot of confusion……Thank u so much…..This blog is really precious for beginner……
LikeLike
Sir,Please guide us what happens when Request goes through module to reach handlers
LikeLike
Great… Very good article
LikeLike
really very nice article.. one of the best article I have ever read ..
LikeLike
Excellent article..!!
LikeLike
Thanks Abhijit Nice article… Many of doubts gets cleared from this.
LikeLike
Thanks Abhijit ,the article is very easy to understand and its is simple english.Thanks
LikeLike
bur sir..when a user processes that page and again send the page for processing to the server…..how does the the IIS recognises that particular user?
LikeLike
Sandhya-Thanks Abhijit article is very easy to understand and concentrated on key points very gud article on IIS
LikeLike
Hi,
Very nice and more helpful article.
LikeLike
Very helpful article. Thank you very much.
LikeLike
Very nice article, thanks a lot
LikeLike
More understandable article, Have more knowledge,………………… Thanx.
LikeLike
good article.
and sir please tell me how to see the structure of worker process under application pool.
LikeLike
Thanks Ajay. Could you please let me know what do you mean by “structure of worker process under application pool” / or please rephrase your question ? It will help me to answer .
LikeLike
Very Good Article.Every One can understood.Thank You Very Much
LikeLike
Thank you very much.
LikeLike
its awesome article i am clarfied with the lot of doubts by reading this…..
LikeLike
This is best article man..It gives Crux of ASP.NET..
I have been following your articles,they are easy to understand and very useful..
Thanks Bro..
LikeLike
Very good article, thanks for posting 🙂
LikeLike
Excellent explanation of IIS Process
LikeLike
Awsmm.. 🙂
LikeLike
Sir ,
In one article I got much idea.
Thank you.
LikeLike
Very useful… sweet and short. I never forgot these things that you explained.
Thank you so much
LikeLike
It is great article for understand the IIS and page request.
Thanks.
LikeLike
Thanks/
LikeLike
Awsum Article. Clean and on point.
LikeLike
Excellent Article .very useful for beginners.
LikeLike
You really make it appear really easy together with your presentation but I find this topic to be actually something which I believe I would by no means understand.
It sort of feels too complex and extremely extensive for
me. I’m looking forward for your subsequent publish, I
will attempt to get the dangle of it!
LikeLike
Really very useful and simplified article. Awesome.
LikeLike
Awesome article… Thanks for it… Keep playing with more articles..
LikeLike
Reblogged this on .Net Development Stack.
LikeLike
really nice article for them who want to know what is IIS? and how it is working?
LikeLike
appreciated for your attempt really wonderful article which helped me a lot,so many doubts are cleared…Thanks
LikeLike
Very Nice
LikeLike
Thanks Abhijit…. This article is very helpful.
LikeLike
Its fantastic article thank u abhijit
LikeLike
Thanks Rohit !
LikeLike
Nice article.. You did great job for young software developers
LikeLike
Thanks and Glad that it was helpful !
LikeLike
That was a great article in simple and understandable yhank you so much
LikeLike
Really neat and clear Article.
Thanks a lot Abhijit Jana.
LikeLike
superb 🙂
LikeLike
Quite an interesting article, and well done for sharing. I am trying to get a feel for how the IIS architecture works when deploying to a webhost. Any pointers?
LikeLike
very helpful .. good work budy and thanks
LikeLike
Very simple and excellent description !!
LikeLike
Thank You Very Much Abhijit Jana..It really help me a lot.
LikeLike
Hi Abhijit,
Very much helpful article with detail knowledge !!
Keep Posting 😉
Thanks,
Ravi
LikeLike
Woow… What an article…. Thanks Abhijit for sharing this detailed article
LikeLike
Thank you very much Abhijith.This Article was very much helpful in improving my knowledge on IIS Server.
LikeLike
Clear Explanation, Helped me a lot.
IIt is very useful for beginners.
LikeLike
Thank you so much Abhijith.Nice explanation 🙂
LikeLike
Superb !! Great article i had ever read
LikeLike
awesome ! Great article
LikeLike
Really good, clear, and useful article. Thank you for sharing!
LikeLike
Nice Article
LikeLike
Nice article ,
Please correct some spelling in this article
For ex. takw – take
Thanks and Happy writing
LikeLike
Very Good Article for beginners !
LikeLike
Really Nice article but i was looking for concept of creating multiple Worker process in Application pool as we have depicted in picture.Although i found and learned it.Inclusion of that point would make this article more details.No questions would be left.Thanks for such a detailed basic subject.
LikeLike
Very good article for a beginner
LikeLike
Superb Article Abhijit. The way you have explained is really awesome. Appreciate your contribution.
LikeLike
Nice Blog Thank …
LikeLike
Dear Abhijit,
Excellent article. It’s very simple and clear view. Thank you so much for your efforts on this.
Thanks,
Behin Vincent
LikeLike
Really awesome information it helps me a lot with clear concept.Good job keep it up.
Thanks,
Anand
LikeLike
Thank you Abhijit , Very nice and easy to understand the IIS work .
LikeLike
Ya it is good.
LikeLike
Very well Explained..thanks Abhijit
LikeLike
Could you please also include some explanation about how a request from asp.net and mvc application is identified and handled by IIS ? That would really help.
Nice Article. Thanks !!
LikeLike
It is very easy to understand.. Thanks Abhijit. Is there any article to understand how Sessions are being handled in IIS Level?
LikeLike
you may take a look into this – https://www.codeproject.com/Articles/32545/Exploring-Session-in-ASP-Net . Wrote long back.
LikeLike
Abhijit thank you so much for a wonderful article.
It’s really informative and easy to understand.
LikeLike
Great work Keep it up Thank you very much and you have done this in a good format
LikeLike
Reblogged this on NuWave eSolutions DevOp Team Technical Discussion.
LikeLike
Great article, simplified way of description, thanks for sharing 🙂
LikeLike
Nice artical
LikeLike
Very nice article, and clear understanding. Its just not for beginners, but also for experienced developers to quickly brush up the fundamentals. Thanks..
On a side note, just wondering how some comments in this article are of year Nov-1999?
LikeLike
Great abhijit sir
LikeLike
Very good sir:)
My name is also Abhijit
LikeLike
What an explanation!!!
Simple and clear language used for explaining this vast topic. It took hardly 15 minutes to understand this concept. I am sure one can’t find any better article than this on “How IIS Process ASP.NET Request”.
Thanks a lot. 🙂
LikeLike
It’s very nice article, Thank you so much for this post.
LikeLike