Applications for Application Dependencies <application>
The <application>
element of the <applicationDependencies> element specifies an application that has dependencies on one or more CGI or ISAPI extension restrictions. Specifically, the groupID attribute of the <application>
element specifies the primary application dependency, and the element may contain one or more <add> elements that specify additional dependencies.
Version | Notes |
---|---|
IIS 10.0 | The <application> element was not modified in IIS 10.0. |
IIS 8.5 | The <application> element was not modified in IIS 8.5. |
IIS 8.0 | The <application> element was not modified in IIS 8.0. |
IIS 7.5 | The <application> element was not modified in IIS 7.5. |
IIS 7.0 | The <application> element of the <applicationDependencies> element was introduced in IIS 7.0. |
IIS 6.0 | The <applicationDependencies> element replaces the IIS 6.0 ApplicationDependencies attribute of the IIsWebService metabase object. |
The <application>
element of the <applicationDependencies>
element is included in the default installation of IIS 7.
There is no user interface for configuring the <applicationDependencies>
element for IIS 7. For examples of how to configure the <applicationDependencies>
element programmatically, see the Code Samples section of this document.
Attribute | Description |
---|---|
groupID |
Optional string attribute. Specifies the groupID of the application that has a dependency on an extension restriction. See the following Default Configuration section for the complete list of default values. |
Name |
Required string attribute. Specifies the unique name of the application that has a dependency on an extension restriction. See the following Default Configuration section for the complete list of default values. |
Element | Description |
---|---|
add |
Optional element. Adds additional groupIDs to the parent application. |
clear |
Optional element. Removes all references to additional groupIDs from the add collection. |
The following configuration sample illustrates the application dependencies in the <applicationDependencies>
element for the Default Web Site and the related entries in the <isapiCgiRestriction>
after you install Active Server Pages (ASP) and a custom application on IIS 7:
- The Active Server Pages application has a dependency on the "ASP" ISAPI/CGI restriction group.
- The custom application has a dependency on the "MyCustomGroup" ISAPI/CGI restriction group, and an additional dependency on the ASP ISAPI/CGI restriction group.
<system.webServer>
<security>
<isapiCgiRestriction notListedIsapisAllowed="false" notListedCgisAllowed="false">
<clear />
<add allowed="true" groupId="ASP"
path="C:\Windows\system32\inetsrv\asp.dll"
description="Active Server Pages" />
<add allowed="true" groupId="MyCustomGroup"
path="C:\Windows\system32\inetsrv\mycustom.dll"
description="My Custom Application" />
</isapiCgiRestriction>
</security>
</system.webServer>
<location path="Default Web Site">
<system.webServer>
<security>
<applicationDependencies>
<application name="My Custom Application" groupId="MyCustomGroup">
<add groupId="ASP" />
</application>
</applicationDependencies>
</security>
</system.webServer>
</location>
The following configuration sample illustrates the application dependencies in the <applicationDependencies>
element for the Default Web Site. The custom application has a dependency on the "MyCustomGroup" ISAPI/CGI restriction group, and an additional dependency on the ASP ISAPI/CGI restriction group.
appcmd.exe set config "Default Web Site" -section:system.webServer/security/applicationDependencies /+"[name='My Custom Application',groupId='MyCustomGroup']" /commit:apphost
appcmd.exe set config "Default Web Site" -section:system.webServer/security/applicationDependencies /+"[name='My Custom Application',groupId='MyCustomGroup'].[groupId='ASP']" /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 applicationDependenciesSection = config.GetSection("system.webServer/security/applicationDependencies", "Default Web Site");
ConfigurationElementCollection applicationDependenciesCollection = applicationDependenciesSection.GetCollection();
ConfigurationElement applicationElement = applicationDependenciesCollection.CreateElement("application");
applicationElement["name"] = @"My Custom Application";
applicationElement["groupId"] = @"MyCustomGroup";
ConfigurationElementCollection applicationCollection = applicationElement.GetCollection();
ConfigurationElement addElement = applicationCollection.CreateElement("add");
addElement["groupId"] = @"ASP";
applicationCollection.Add(addElement);
applicationDependenciesCollection.Add(applicationElement);
serverManager.CommitChanges();
}
}
}
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 applicationDependenciesSection As ConfigurationSection = config.GetSection("system.webServer/security/applicationDependencies", "Default Web Site")
Dim applicationDependenciesCollection As ConfigurationElementCollection = applicationDependenciesSection.GetCollection
Dim applicationElement As ConfigurationElement = applicationDependenciesCollection.CreateElement("application")
applicationElement("name") = "My Custom Application"
applicationElement("groupId") = "MyCustomGroup"
Dim applicationCollection As ConfigurationElementCollection = applicationElement.GetCollection
Dim addElement As ConfigurationElement = applicationCollection.CreateElement("add")
addElement("groupId") = "ASP"
applicationCollection.Add(addElement)
applicationDependenciesCollection.Add(applicationElement)
serverManager.CommitChanges()
End Sub
End Module
var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
var applicationDependenciesSection = adminManager.GetAdminSection("system.webServer/security/applicationDependencies", "MACHINE/WEBROOT/APPHOST/Default Web Site");
var applicationDependenciesCollection = applicationDependenciesSection.Collection;
var applicationElement = applicationDependenciesCollection.CreateNewElement("application");
applicationElement.Properties.Item("name").Value = "My Custom Application";
applicationElement.Properties.Item("groupId").Value = "MyCustomGroup";
var applicationCollection = applicationElement.Collection;
var addElement = applicationCollection.CreateNewElement("add");
addElement.Properties.Item("groupId").Value = "ASP";
applicationCollection.AddElement(addElement);
applicationDependenciesCollection.AddElement(applicationElement);
adminManager.CommitChanges();
Set adminManager = WScript.CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
Set applicationDependenciesSection = adminManager.GetAdminSection("system.webServer/security/applicationDependencies", "MACHINE/WEBROOT/APPHOST/Default Web Site")
Set applicationDependenciesCollection = applicationDependenciesSection.Collection
Set applicationElement = applicationDependenciesCollection.CreateNewElement("application")
applicationElement.Properties.Item("name").Value = "My Custom Application"
applicationElement.Properties.Item("groupId").Value = "MyCustomGroup"
Set applicationCollection = applicationElement.Collection
Set addElement = applicationCollection.CreateNewElement("add")
addElement.Properties.Item("groupId").Value = "ASP"
applicationCollection.AddElement(addElement)
applicationDependenciesCollection.AddElement(applicationElement)
adminManager.CommitChanges()