IIS 6.0 -Applications,Sites,Virtual Dir…

Posted: July 19, 2008 in ASP.NET
Tags: ,

For the past few years while interacting with developers in the .NET community I have seen that they are very much conversant with language (C#) and ASP.NET features.But very few of them has a clear idea about idea about how IIS works and the ASP.NET Request Pipeline.So in this blog and subsequent blogs I will covering some key aspects of II6.0 and ASP.NET Request processing model.

IIS Web Site

The first important unit of IIS 6.0 Infrastructure is the IIS Web Site.A IIS Web Site is configured to listen to incoming HTTP requests

By default IIS created an web site named Default Website and configured to listen on port 80.Additional sites can be configured using the IIS Administration tool.

IIS Virtual Directory

Every IIS Website maps to a physical folder in the server.The Default Website maps to C:\Inetpub\wwwroot folder by default.A virtual directory within a site is a container of files and defines a child URL space within the website e.g. If we create a virtual directory called Chat within the website www.xyz.com then it can be accessed as http://www.xyz.com/Sales .We can map this virtual directory to a physical folder named D:\Chat in the server.

IIS Application or Virtual Application

In IIS 6.0 the terms application and virtual directory is bit confusing and is found to be used interchangeably in many tech articles.An application can be considered as a virtual directory with a additional properties like Application Name,Application Root(Starting Point),Application Pool ID.The Web Site by default is associated with an application even if the above mentioned properties are not specfically set.An application should have at least one virtual directory.It can also have more than one virtual directories.e.g The WebSite www.xyz.com can contain a virtual directory as well as application named Chat (www.xyz.com/Chat) and within the application Chat there can be another virtual directory Messages (http://www.xyz.com/Chat/Messages).  This virtual directory may not be an application .

 Application Pool

An application pool is a mechanism to group and isolate a set of web applications hosted by the IIS server.Each web application is assigned to one application pool.Each application pool runs in the different instance of the worker process(w3wp.exe).e.g. there is WebApp A assigned to AppPool AP1 and WebApp B assigned to App Pool AP2 then WebApp A and B runs in two seperate processes executing different instances of w3wp.exe.This ensures better application isolation and protection i.e. failure of any one the applications will not hamper the execution of the other.Application Pool identity is the identity under which the application pool worker process executes.By default this is the network service account.This can be changed and configured using the IIS Admin Tool.The other important configurations include the application pool health monitoring and worker process recycling.The details are provided in IIS documentation http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/f05a7c2b-36b0-4b6e-ac7c-662700081f25.mspx?mfr=true

  1. Larry says:

    I think I’m running into Application Pool hell (the sequel to ddl hell). I have numerous web app’s running on Windows Server 2003, most with their own app pools. However, I’m seeing what look like virtual directories in each app pool (gear-like icons), and there’s no way to delete them. Some have duplicates, and other apps have multiple app pools. It looks like this:

    Application Pools
    Default App
    Default Application

    What in the world is going on here? I didn’t create most of these!

  2. sankarsan says:

    Hi Larry,
    Under the Application Pools first you will find the list of Application Pools and then under each Application Pool you will find the list of Applications/Web Sites(Default Applications) using that Application Pools.From this view delete option will be available only for the application pools but not for the web applications or the web sites under each Application pool.
    If you want to do a clean up you can follow the steps mentioned below:
    1) Identify the list of Web Sites/Web Applications which are relevant
    2) Determne the Application Pools they needs.i.e what can be clubbed in a single application pool and which application needs seperate application pool.
    3) Create the newly identified appliaction pools by right clicking on the application pools node.
    4) Go to the properties of the web applications and set the right application pool.
    5) Go to the Application Pool node and delete the unused application pools.

  3. Larry says:

    Thanks! I kind of did that finally. I found some applications had muliple application pools – one for the app, and others for virtual directories within that app. I made sure that every app used one and only one app pool. This cleaned up a lot of the mess. However, I was still left with “phantom” applications within some app pools. I think they may have come from applications or virtual directories that were since deleted, but I don’t know why they left their footprints behind in the app pools. In any case, these phantoms were only seen on the test server. After cleaning up the production server all the apps and app pools seemed to line up nicely.

    Again, thanks for the explanation – that helps!

  4. sankarsan says:

    That’s great to hear….

  5. so says:

    ‘Phantomed’ apps occur when apps / vdirs are just deleted without being removed as an app. If you re-create them in their original location in IIS, then on the home directory tab > application name – hit the ‘remove’ button; then delete them you should find they are removed neatly from the app pools too…

  6. sandrar says:

    Hi! I was surfing and found your blog post… nice! I love your blog. 🙂 Cheers! Sandra. R.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s