23

How is application pool implemented in IIS?

  1. Is each application pool equivalent to a .Net AppDomain?
  2. Or it is a equivalent to a .Net process?
  3. How is Application pool related to IIS w3wp.exe?
Amitabh
  • 51,891
  • 40
  • 102
  • 154

4 Answers4

25

1 . Is each application pool equivalent to a .Net AppDomain?

No, an application pool may have several AppDomains. Each AppDomain represents a single running ASP.NET Application. Many ASP.NET Applications may belong to a single Application Pool.

2 . Or it is a equivalent to a .Net process?

Not quite. See below.

3 . How is Application pool related to IIS w3wp.exe?

An application pool represents a limited number of worker processes that may host a potentially larger number of applications. This is similar to how a SQL Connection Pool shares a limited number of connections among an arbitrary number of requests.

By default, an Application Pool gets one Worker Process (w3wp.exe), and it's usually best to leave this setting alone unless you know what you're doing. Still, an Application Pool can be configured to use any number of processes.

The Worker Process is actually the resource that's being pooled here, not the AppDomain. There will always be the same number of AppDomains as there are ASP.NET Applications (unless one is in the middle of shutting down, or an application creates its own AppDomains), but the number of Worker Processes is independent; an Application Pool gives you a specific number of Worker Processes to handle requests for a specific number of AppDomains.

A setting of 1 (the default) for the number of worker processes in an App Pool means that all Applications/AppDomains in the pool share the same worker process.

Aaronaught
  • 115,846
  • 24
  • 251
  • 329
5

It's an oversimplification to say it this way but the best way to think about it is that the AppPool is a pool of AppDomains. All of these AppDomains run within a single worker process (w3wp.exe).

Andrew Hare
  • 320,708
  • 66
  • 621
  • 623
  • Thanks Andrew. Could you also add, when is the application pool created? how does it help to put your web application under a pool? – shahkalpesh Apr 17 '10 at 18:59
  • @shahkalpesh: in IIS6+ I don't think can have an app that's not in an app pool. You might also find this link helpful (http://weblogs.asp.net/owscott/archive/2007/09/02/application-vs-appdomain.aspx) – R0MANARMY Apr 17 '10 at 19:03
2

Another important thing to mention is Application Security.

In previous versions of IIS, worker processes ran as LocalSystem, a powerful account that has system administrator privileges on the server. Because LocalSystem has access to almost all resources on the operating system, this caused security implications. In IIS 6.0 (Application pool introduced), one can set the identity of the worker process at the application pool level. The identity of an application pool is the account under which the application pool's worker process runs. By default, application pools operate under the NetworkService account, which has low-level user access rights.

By running the worker process using a very low-privileged account such as NetworkService, one can reduce the security vulnerability. However, by using IIS manager, it is possible to configure the application pool to run as any of the following pre-defined accounts:

NetworkService
LocalSystem
LocalService
Mahbubur Rahman
  • 4,261
  • 2
  • 28
  • 43
1

I know this is an old post, but I think this is a good accent:

1 Application Pool (IIS) = 1 Request Queue (in HTTP.SYS) + 1 or more instances of w3wp.exe.

Vince Fedorchak
  • 1,055
  • 4
  • 11
  • 19