What is an IIS application pool? - asp.net

What exactly is an application pool? What is its purpose?

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.
Additionally, applications pools allow you to separate different apps which require different levels of security.
Here's a good resource: IIS and ASP.NET: The Application Pool

I second the top voted answer, but feel like adding little more details here if anyone finds it useful.
short version:
IIS runs any website you configure in a process named w3wp.exe. IIS
Application pool is feature in IIS which allows each website or a part
of it to run under a corresponding w3wp.exe process. So you can run
100 websites all in a single w3wp.exe or 100 different w3wp.exe. E.g.
run 3 websites in same application pool(same w3wp.exe) to save memory
usage. ,run 2 different websites in two different application pools so
that each can run under separate user account(called application pool
identity). run a website in one application pool and a subsite
'website/app' under a different application pool.
Longer version:
Every website or a part of the website,you can run under an application pool.You can control some basic settings of the website using an application pool.
You would like the website to run under a different w3wp.exe process.Then create a new application pool and assign that to the website.
You would like to run the website and all it's code under a different user account(e.g under Admin privileges),you can run do that by changing Application Pool Identity.
You would like to run a particular application under .net framework 4.0 or 2.0.
You would like to make sure the website in 32 bit mode or have a scheduled recycle of the w3wp.exe process etc.All such things are controlled from iis application pool.

Basically, an application pool is a way to create compartments in a web server through process boundaries, and route sets of URLs to each of these compartments. See more info here: http://technet.microsoft.com/en-us/library/cc735247(WS.10).aspx

An application pool is a group of one or more URLs that are served by a worker process or set of worker processes. Any Web directory or virtual directory can be assigned to an application pool.
Every application within an application pool shares the same worker process.

Assume scenario where swimmers swim in swimming pool in the areas reserved for them.what happens if swimmers swim other than the areas reserved for them,the whole thing would become mess.similarly iis uses application pools to seperate one process from another.

IIS-Internet information Service is a web server used to host one or more web application .
Lets take any example here say Microsoft is maintaining web server and we are running our website abc.com (news content based)on this IIS.
Since, Microsoft is a big shot company it might take or also ready to host another website say xyz.com(ecommerce based).
Now web server is hosting i.e providing memory to run both websites on its single web server.Thus , here application pools come into picture .
abc.com has its own rules, business logic , data etc and same applies to xyz.com.
IIS provides two application pools (path) to run two websites in their own world (data) smoothly in a single webserver without affecting each ones matter (security, scalability).This is application pool in IIS.
So you can have any number of application pool depending upon on servers capacity

An application pool is a group of urls served by worker processors or set of worker processors.
There can exist any number of application pools.
In IIS it is possible to create more than one application pool.
An application in different application pool runs in different worker processors.
Advantage: If an error occurred in one application pool will not effect the applications running in another application pool.

An Application pool is a collection of applications which uses the same worker process of IIS (w3wp.exe). Primary concern of using Application pool is to isolate two different applications with different security concerns and also to avoid crashing of applications due to worker process death.

An application pool is a group of one or more URLs that are served by a worker process or set of worker processes. Application pools are used to separate sets of IIS worker processes that share the same configuration and application boundaries. Application pools are used to isolate our web application for better security, reliability, availability and performance, and they keep running without impacting each other.

Application pools are used to separate sets of IIS worker processes that share the same configuration and application boundaries.
Application pools used to isolate our web application for better security, reliability, and availability and performance and keep running without impacting each other . 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. One Application Pool can have multiple worker process Also.
Or we can simply say that, An application pool is a group of one or more URLs that are served by a worker process or set of worker processes. Any Web directory or virtual directory can be assigned to an application pool. So that one website cannot be affected by other, if u used separated application pool.
Source : Interviewwiz

An application pool is like a pond, if I create 2 application pools, first application pool has 100 fishes and another application pool has 200 fishes, here fish is like an application in application pool.
They are managed by worker processes. Best advantage is: if pond number-1 has bad water and cases all fish are effected then there is security of fish in pond number-2. Like this if any application pool is affected by any problem but there is not any effect of this problem in application pool 2 so security improves, and another benefit is that is you provide all the necessary authentication and rights to all applications in a single application pool.

An application pool is a group of one or more URLs that are served by a worker process or set of worker processes. Application pools are used to separate sets of IIS worker processes that share the same configuration and application boundaries.

Application pools are used to separate set of IIS worker processes that share the same configuration.
Application pools enable us to isolate our web application for better security, reliability, and availability

The application Pools element contains configuration settings for all application pools running on your IIS. An application pool defines a group of one or more worker processes, configured with common settings that serve requests to one or more applications that are assigned to that application pool.
Because application pools allow a set of Web applications to share one or more similarly configured worker processes, they provide a convenient way to isolate a set of Web applications from other Web applications on the server computer.
Process boundaries separate each worker process; therefore, application problems in one application pool do not affect Web sites or applications in other application pools. Application pools significantly increase both the reliability and manageability of your Web infrastructure.

application pool provides isolation for your application. and increase the availability of your application because each pool run in its own process so an error in one app won't cause other application pool. And we have shared pool that hosts several web applications running under it and dedicated pool that has single application running on it.

Related

Difference between an application domain and an application pool?

What is difference between application domain and application pool?
I have read many articles regarding these two terminology. but still unable to get proper understanding about them.
Please elaborate it with simple description.
Thanks
IIS process is w3wp;
Every application pool in IIS use it's own process;
AppPool1 uses process 3784, AppPool2 uses process 5044
Different applications in Asp.net will use different
AppDomain;
AppTest1 and AppTest2 are in different AppDomain, but in
the same process.
What's the point to use them?
Application pool and AppDomain , both of them can provide
isolations, but use different approaches. Application pool
use the process to isolate the applications which works
without .NET. But AppDomain is another isolation methods
provided by .NET.
If your server host thousands of web sites, you wont use
thousands of the application pool to isolate the web sites,
just because, too many processes running will kill the os.
However, sometime you need application pool. One of the
advantages for application pool is that you can config the
identity for application pool. Also you have more flexible
options to recycle the application pool. At least right now,
IIS didn't provide explicit options to recycle the appdomain.
An application pool is a group of one or more URLs of
different Web applications and Web sites. Any Web directory
or virtual directory can be assigned to an application pool.
Every application within an application pool shares the same
worker process executable, W3wp.exe, the worker process that
services one application pool is separated from the worker
process that services another [Like starting MS Word and
opening many word documents]. Each separate worker process
provides a process boundary so that when an application is
assigned to one application pool, problems in other
application pools do not affect the application. This
ensures that if a worker process fails, it does not affect
the applications running in other application pools. [i.e]
for Eg., If word document is having issue it should not
logically affect your Excel Sheet isn’t it.
application domain is a mechanism (similar to a process in
an operating system) used to isolate executed software
applications from one another so that they do not affect
each other. [i.e] opening of MS WORD doesn’t affect MS EXCEL
you can open and close both the applications any time since
there is no dependency between the applications. Each
application domain has its own virtual address space which
scopes the resources for the application domain using that
address space.
Thanks to this link

Subsites under same application pool

I got a website, will create many subsites under this one ( may be around 300). Can I place all these susbites under one application pool?
You can host several web sites in the same application pool, but you should understand that you're creating a dependency among the sites in the same application pool -- they'll run as part of the same process, and if you have to restart the application pool for any reason, it will affect all sites in that pool. In some cases, this might make sense for you, but you should probably review online documentation to be sure this is what you want to do.
Introduction to IIS 7 Architecture
Managing Application Pools in IIS 7

What is best practice in IIS? One application pool for each application, or a shared application pool?

In IIS 7, what is best practice? Should I create an application pool for each application, or should I share an application pool with as much application as possible?
Are there any performance drawbacks or security issues related to one of the options?
Each application pool is an instance of W3wp.exe, a worker process for that site or set of sites. By placing each application in a seperate app pool, you ensure that problems that could potentially cause problems within the app pool do not cause problems with other applications. There is obviously an overhead to operating like this in terms of resources.
So generally, for simple sites and blogs I usually put these in a shared app pool. For more intensive or important applications, I seperate into individual app pools. This is just a guide to how I operate.
I believe IIS7 now creates seperate app pools when you create a web site (not 100% though).
In theory it is better to put each site to its own pool. In practice it takes much more RAM than placing the sites to a single pool. So, on most servers you will see 10-100 pools only, even if there are 1000 sites.
Sharing Application pool is better than creating an application pool for each application for a fixed number of application
You can run as many application pools on your IIS 7 server as you need but this will affect server performance.On the other hand Application pools allow a set of Web applications to share one or more similarly configured worker processes but you should not share an application pool to a lot of application.Because This will affect your server performance too!
So in both way you have to be tactful.

Run Many ApplicationPools in one WebApplication on IIS 7+

It's possible to run more that one aplication pool in the same WebApplication on IIS 7 or 7.5? I have one web application on asp.net 4.0 that use EF 4.0 and a large set of Entities. Then the First query Its to slow and when the application pool fails, the users need to login again, but the pool was restarted and the first query Its too slow, this cause any can't login for a time (about the time that the old pool is finished and the new pool It's ready).
If I can use multiple applications pools for the same site, on the same port 8080 for example, thats solve my problem. The only way I found was to create a server farm. However, if I understand, each servers would be a virtual or real machine?
You can have multiple applications and associated pools running under one site directory root. In IIS 7 manager, simply right-click on the folder in question and select "Create Application" in the resulting dialog set the new application pool and the physical path. This will mean that you have to segregate your code into separate projects/modules (web applications or web application projects in vs) but they will all share the same site.

Confusing terminologies pertaining to Application Pool, Worker Process and Application Domain

Edit 1
I am confused with the statement below, taken from What ASP.NET Programmers Should Know About Application Domains :
You’ve created two ASP.NET
applications on the same server, and
have not done any special
configuration. What is happening?
A single ASP.NET worker process will
host both of the ASP.NET applications.
On Windows XP and Windows 2000 this
process is named aspnet_wp.exe, and
the process runs under the security
context of the local ASPNET account.
On Windows 2003 the worker process has
the name w3wp.exe and runs under the
NETWORK SERVICE account by default.
He said that there is one worker process spawns 2 application domains--one application domain for each asp.net application.
But when I see the running processes as follows,
Image 1
Image 2
w3wp.exe is said as IIS Worker Process rather than application pool or application domain.
Questions:
Is application domain equal to application pool?
The confusing thing is in image 1. Why does Host Process Windows Service svchost.exe spawns 2 IIS Worker Process w3wp.exe? In my understanding, a process can only contain application domains, not other processes.
Application domain aka AppDomain (its class representation) is an encapsulated environment inside a .NET runtime where assemblies are loaded and running.
Usually there is one AppDomain/Application domain per managed process but can be more. Here the article refers to 2 AppDomains inside the same w3wp3.exe process.
You can see number of AppDomains loaded in any process using perfmon.exe
To answer your question, usually one AppDomain is created per one AppPool. But it is possible to load extra AppDomains manually in the AppPool by the application - but that would be very uncommon.
Update
I think you are using Process Explorer of the Sysinternals. Ignore the way it shows the tree structure in there, it only illustrates which process has spawned other processes. In fact it shows most processes underneath explorer since explorer has been used to load it.
Also SVCHOST.exe is an unmanaged executable and although it can host CLR and load AppDomains, it normally does not do that.

Resources