Application Defaults <applicationDefaults>


The <applicationDefaults> element of the <sites> element specifies the default application settings for all applications on the server.

Note: If the same attribute or child element is configured in both the <applicationDefaults> section and in the <application> section for a specific application, the configuration in the <application> section is used for that application.


Version Notes
IIS 7.5 The <applicationDefaults> element was not modified in IIS 7.5.
IIS 7.0 The <applicationDefaults> element of the <sites> element was introduced in IIS 7.0.
IIS 6.0 The <applicationDefaults> element is analogous to setting setting application options at the W3SVC level in the IIS 6.0 metabase.


The <applicationDefaults> element of the <sites> element is included in the default installation of IIS 7.

How To

How to configure the default application settings for a server

  1. Open 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.
  2. In the Connections pane, expand the server name, then click the Sites node.
  3. In the server's Sites pane, click Set Web Site Defaults... in the Actions pane.
  4. In the Web Site Defaults dialog box, specify your default application settings for all Web sites, and then click OK.



Attribute Description
applicationPool Optional string attribute.

Specifies the default application pool to which all applications on the server are assigned.
enabledProtocols Optional string attribute.

Specifies the protocols to use to communicate with all applications on the server.
path Optional string attribute.

Specifies the default virtual path of all applications on the server.

Child Elements


Configuration Sample

The following configuration sample sets the default application pool for all Web sites to "DefaultAppPool".

     <applicationDefaults applicationPool="DefaultAppPool" />

Sample Code

The following code samples set the default application pool for all Web sites to "DefaultAppPool".


appcmd.exe set config -section:system.applicationHost/sites /applicationDefaults.applicationPool:"DefaultAppPool" /commit:apphost

Note: You must be sure to set the commit parameter to apphost when you use AppCmd.exe to configure these settings. This commits the configuration settings to the appropriate location section in the ApplicationHost.config file.


using System;
using System.Text;
using Microsoft.Web.Administration;

internal static class Sample
   private static void Main()
      using (ServerManager serverManager = new ServerManager())
         Configuration config = serverManager.GetApplicationHostConfiguration();
         ConfigurationSection sitesSection = config.GetSection("system.applicationHost/sites");

         ConfigurationElement applicationDefaultsElement = sitesSection.GetChildElement("applicationDefaults");
         applicationDefaultsElement["applicationPool"] = @"DefaultAppPool";



Imports System
Imports System.Text
Imports Microsoft.Web.Administration

Module Sample

   Sub Main()
      Dim serverManager As ServerManager = New ServerManager
      Dim config As Configuration = serverManager.GetApplicationHostConfiguration
      Dim sitesSection As ConfigurationSection = config.GetSection("system.applicationHost/sites")

      Dim applicationDefaultsElement As ConfigurationElement = sitesSection.GetChildElement("applicationDefaults")
      applicationDefaultsElement("applicationPool") = "DefaultAppPool"

   End Sub

End Module


var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
var sitesSection = adminManager.GetAdminSection("system.applicationHost/sites", "MACHINE/WEBROOT/APPHOST");

var applicationDefaultsElement = sitesSection.ChildElements.Item("applicationDefaults");
applicationDefaultsElement.Properties.Item("applicationPool").Value = "DefaultAppPool";



Set adminManager = WScript.CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
Set sitesSection = adminManager.GetAdminSection("system.applicationHost/sites", "MACHINE/WEBROOT/APPHOST")

Set applicationDefaultsElement = sitesSection.ChildElements.Item("applicationDefaults")
applicationDefaultsElement.Properties.Item("applicationPool").Value = "DefaultAppPool"

Deprecated Elements