次の方法で共有


アプリケーション依存関係のアプリケーション <application>

概要

<applicationDependencies> 要素の <application> 要素は、1 つ以上の CGI または ISAPI 拡張機能の制限に依存するアプリケーションを指定します。 具体的には、<application> 要素の groupID 属性はプライマリ アプリケーションの依存関係を指定し、要素には追加の依存関係を指定する 1 つ以上の <add> 要素を含めることができます。

互換性

バージョン メモ
IIS 10.0 <application> 要素は、IIS 10.0 では変更されませんでした。
IIS 8.5 <application> 要素は、IIS 8.5 では変更されませんでした。
IIS 8.0 <application> 要素は IIS 8.0 では変更されませんでした。
IIS 7.5 <application> 要素は、IIS 7.5 では変更されませんでした。
IIS 7.0 <applicationDependencies> 要素の <application> 要素が IIS 7.0 で導入されました。
IIS 6.0 <applicationDependencies> 要素は、IIsWebService メタベース オブジェクトの IIS 6.0 ApplicationDependencies 属性を置き換えます。

段取り

<applicationDependencies> 要素の <application> 要素は、IIS 7 の既定のインストールに含まれています。

操作方法

IIS 7 の <applicationDependencies> 要素を構成するためのユーザー インターフェイスはありません。 <applicationDependencies> 要素をプログラムで構成する方法の例については、このドキュメントのコード サンプルのセクションを参照してください。

構成

属性

属性 説明
groupID 省略可能な文字列属性。

拡張機能の制限に依存するアプリケーションの groupID を指定します。

既定値の完全な一覧については、次の既定の構成セクションを参照してください。
Name 必須の文字列属性です。

拡張機能の制限に依存するアプリケーションの一意の名前を指定します。

既定値の完全な一覧については、次の既定の構成セクションを参照してください。

子要素

要素 説明
add 省略可能な要素です。

親アプリケーションに groupID を追加します。
clear 省略可能な要素です。

追加コレクションから追加の groupID へのすべての参照を削除します。

構成サンプル

次の構成サンプルは、Active Server Pages (ASP) とカスタム アプリケーションを IIS 7 にインストールした後の、既定の Web サイトの <applicationDependencies> 要素内のアプリケーションの依存関係と <isapiCgiRestriction> 内の関連エントリを示しています。

  • Active Server Pages アプリケーションは、"ASP" ISAPI/CGI 制限グループに依存しています。
  • カスタム アプリケーションには、"MyCustomGroup" ISAPI/CGI 制限グループへの依存関係と、ASP ISAPI/CGI 制限グループへの追加の依存関係があります。
<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>

サンプル コード

次の構成サンプルは、既定の Web サイトの <applicationDependencies> 要素内のアプリケーションの依存関係を示しています。 カスタム アプリケーションには、"MyCustomGroup" ISAPI/CGI 制限グループへの依存関係と、ASP ISAPI/CGI 制限グループへの追加の依存関係があります。

AppCmd.exe

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

AppCmd.exe を使用してこれらの設定を構成するときは、commit パラメーターを必ず apphost に設定する必要があります。 これで、ApplicationHost.config ファイルの適切な場所セクションに構成設定がコミットされます。

C#

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();
      }
   }
}

VB.NET

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

JavaScript

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();

VBScript

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()