Exploring ASP.NET and IIS Web Server: Understanding Request Handling and Web Gardening
Question :--what is ASP .net IIS web server how this work? how it handle request ? what is web gardening?
Answer :When a request comes from client to the server a lot of operations is performed before sending the response to client browser. This is all about how IIS process the request from client to server.
So in this article I will explain about IIS Request Processing and concept of ASP.Net Worker Process and IIS Application Pool.
When we run our asp.net web application from Visual Studio IDE, there visual studio integrated asp.net engine is responsible to execute all kind of asp.net requests and responses. The "WebDev.WebServer.Exe" process take care of all request and response of an web application which is running from Visual Studio IDE.
So 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.
IIS (Internet Information Server) is one of the most powerful web server 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.
There are two main major concepts available in IIS Process Request:-
Worker Process (w3wp.exe)
Application Pool
Worker Process (w3wp.exe)
Worker 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.
In a single word we can say "Worker process is the heart of asp.net web application which runs on IIS"
How to run Worker Process
If you are debugging a ASP.NET web application which is hosted on IIS7, you need to attach the particular worker process in Visual Studio to start debugging.
To Attach a process we can go to Tools -> Attach Process or use shortcut key Ctrl +P. The process window will show the worker process (w3wp.exe) which is currently running on IIS7. You need to select the process and click on attach button to start the debugging.
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.
Application pools allow you to isolate your applications from one another, even if they are running on the same server. This way, if there is an error in one app, it won't take down other applications.
Application Pool with multiple worker process is called "Web Garden"
Summary : 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.