What is an Application Pool?
An Internet Information Services (IIS) application pool is a set of URLs that is routed to one or more worker processes. Application pools responsible for to isolate one or more applications into their own process. For example you have two different website like website-A and website-B and want to deploy on same server, then application pool isolate your website means website-A run on one application pool and website-B run on another application pool.
It provides a convenient way to administer a set of web sites and applications and their corresponding worker processes. Process boundaries separate each worker process; therefore, a web site or application in one application pool will not be affected by application issues in other application pools. Application pools significantly increase both the reliability and manageability of a Web infrastructure.
What is Application Pool Recycling in IIS?
Recycling means the worker process that handles requests for that application pool is terminated and a new one started. This is generally done to avoid unstable states that can lead to application crashes, hangs, or memory leaks.
By default IIS will use overlapped recycle method, which keeps the old process up until the current requests are finished processing (or a set timeout elapses) while the new process handles new requests. This ensures service continuity so that you usually do not notice a recycle.
How to set up periodic recycling for an application pool
- Open Internet Information Services (IIS) Manager:
- If you are using Windows Server 2012 or Windows Server 2012 R2:
- On the taskbar, click Server Manager, click Tools, and then click Internet Information Services (IIS) Manager.
- If you are using Windows 8 or Windows 8.1:
- Hold down the Windows key, press the letter X, and then click Control Panel.
- Click Administrative Tools, and then double-click Internet Information Services (IIS) Manager.
- If you are using Windows Server 2008 or Windows Server 2008 R2:
- On the taskbar, click Start, point to Administrative Tools, and then click Internet Information Services (IIS) Manager.
- If you are using Windows Vista or Windows 7:
- On the taskbar, click Start, and then click Control Panel.
- Double-click Administrative Tools, and then double-click Internet Information Services (IIS) Manager.
- If you are using Windows Server 2012 or Windows Server 2012 R2:
- In the Connections pane, expand the server name, and then click Application Pools.
- In the Application Pools pane, select the application pool you want edit.
- In the Actions pane, click Recycling…
- On the Recycling Conditions page of the Edit Application Pool Recycling Settings Wizard, select at least one of the options in the Fixed Intervals section, type values into the appropriate text boxes, and then click Next.
- (Optional) On the Recycling Events to Log page of the Edit Application Pool Recycling Settings Wizard, select the configurable recycling events and run-time recycling events that you want IIS to send to the event log when they occur, and then click Finish.
Where can I configure Automatic Application Pool Recycling?
In Windows 2003
Go to Start -> Administrative Tools -> Internet Information Services (IIS) Manager. Expand the server and the “Application Pools” Group. Right-click the Application Pool you wish to configure and select “Properties”. In the first tab you will find the recycling settings.
In Windows 2008 R2
Go to Start -> Administrative Tools -> Internet Information Services (IIS) Manager. Expand the server and click on “Application Pools”. In the center window right-click the Application Pool you wish to configure and select “Recycling…” ( be careful not to click “Recycle…” which will start a recycle).
You will be shown a two-step “wizard”. In the first half you will select which settings to use and in the second, which you want to log (in windows event logs) in case they are triggered.
Different Type of Managed Pipeline mode in IIS
There are two types’ .NET integration modes for ASP.NET application, that identified that how IIS processes an incoming request to the sites, applications and web services that run in that application pool.
Integrated mode makes ASP.NET an integral part of IIS. Now the IIS server functionality is split into more than 40 modules that break the IIS and ASP.NET functionality into pieces. Modules such as StaticFileModule, BasicAuthenticationModule, FormsAuthentication, Session, Profile and RoleManager are part of the IIS pipeline. FormsAuthentication, Session, Profile and RoleManager were previously part of ASP.NET and didn’t have anything to do with IIS.
Classic mode models the IIS 6.0 model in which ASP.NET is an ISAPI add-on to IIS. This mode is available for backward compatibility but lacks many of the features in the new integrated mode. In Classic mode, IIS has its own pipeline that can only be extended by creating an ISAPI extension, which has a well-deserved reputation for being difficult to develop. ASP.NET is run as an ISAPI extension that is just one part of the IIS pipeline.
Application Pool Identity Account
An application pool identity account allows you to run an application under a unique account without having to create and manage domains or local accounts. On IIS 8.0+ the IIS Admin Worker Process (WAS) will create a virtual account with the name of the new application pool and run the application pool’s worker processes under this account by default.
Configuring IIS Application Pool Identities
In the IIS Management Console, under Advanced Settings for your application pool ensure that Identity list item is set to use ApplicationPoolIdentity as shown in the image below.
The IIS management process creates a secure identifier with the name of the application pool in the Windows Security System. Resources can be secured by using this identity, however this identity is not a real user account and will not show up in the Windows User Management Console.
To grant the IIS worker process access to your application, you will need to modify the Access Control List (ACL) for the the directory containing your application.
- Open Windows Explorer and navigate to the directory.
- Right click on the directory and click properties.
- Under the Security tab, click the Edit button and then the Add button
- Click the Locations and make sure you select your server.
- Enter IIS AppPool\DefaultAppPool in Enter the object names to select textbox.
- Click the Check Names button and then click OK.
You can also do this via the command-line by using ICACLS tool.
ICACLS C:\sites\MyWebApp /grant "IIS AppPool\DefaultAppPool" :F
If you have any questions feel free to contact me on firstname.lastname@example.org also follow me on facebook @windowstechno to get updates about new blog posts.