CGIまたはISAPI拡張制限に依存するアプリケーション <application>

  • 概要
  • 互換性
  • セットアップ
  • 方法
  • 構成
  • サンプル コード

概要

<applicationDependencies> 要素の <application> 要素では、1 つ以上の CGI または ISAPI 拡張制限に依存するアプリケーションが指定されます。特に、<application> 要素の groupID 属性では、 主要なアプリケーションの依存関係が指定されます。この要素には、追加の依存関係を指定する 1 つ以上の <add> 要素を組み込むことができます。

互換性

  IIS 7.0 IIS 6.0
注意 <applicationDependencies> 要素の <application> 要素は IIS 7.0 で新たに導入された要素です。 <applicationDependencies> 要素は、IIS 6.0 の IIsWebService メタベース オブジェクトの ApplicationDependencies 属性に代わるものです。

セットアップ

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

方法

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

構成

属性

属性 説明
groupID オプションの string 属性。

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

既定の値の完全な一覧については、この後の「既定の構成」を参照してください。
Name 必須の string 属性。

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

既定の値の完全な一覧については、この後の「既定の構成」を参照してください。

子要素

要素 説明
add オプションの要素。

親アプリケーションに追加の groupID を加えます。
clear オプションの要素。

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

構成サンプル

次の構成サンプルは、IIS 7.0 への Active Server Pages (ASP) とカスタム アプリケーションのインストール後、Default Web Site の <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>

サンプル コード

次の構成サンプルは、Default Web Site の <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

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