次の方法で共有


ISAPI/CGI 制限の追加 <add>

概要

<isapiCgiRestriction> コレクション内の <add> 要素を使用すると、インターネット インフォメーション サービス (IIS) 7 で実行できる個々の Common Gateway Interface (CGI) アプリケーションとインターネット サーバー アプリケーション プログラミング インターフェイス (ISAPI) アプリケーションを指定できます。

互換性

バージョン メモ
IIS 10.0 <add> 要素は、IIS 10.0 では変更されませんでした。
IIS 8.5 <add> 要素は、IIS 8.5 では変更されませんでした。
IIS 8.0 <add> 要素は IIS 8.0 では変更されませんでした。
IIS 7.5 <add> 要素は、IIS 7.5 では変更されませんでした。
IIS 7.0 <isapiCgiRestriction> コレクションの <add> 要素は IIS 7.0 で導入されました。
IIS 6.0 <isapiCgiRestriction> コレクションは、IIS 6.0 IIsWebService メタベース オブジェクトの WebSvcExtRestrictionList プロパティを置き換えます。

段取り

<isapiCgiRestriction> コレクションは、IIS 7 以降のサーバーに CGI または ISAPI 拡張機能モジュールをインストールした後にのみ使用できます。 これらの機能と独立してインストールすることはできません。

Windows Server 2012 または Windows Server 2012 R2

  1. タスク バーで [サーバー マネージャー]をクリックします。
  2. [サーバー マネージャー] で、[管理] メニューを選択し、[役割と機能の追加] を選択します。
  3. 役割と機能の追加ウィザードで、[次へ] を選択します。 [インストールの種類] を選択し、[次へ] を選択します。 対象サーバーを選択し、[次へ] を選択します。
  4. [サーバーの役割] ページで [Web サーバー (IIS)] を展開し、[Web サーバー][アプリケーション開発] の順に展開し、[CGI] または [ISAPI 拡張機能] を選択します。 次へ をクリックします。
    Screenshot of the I S A P I Extensions option being highlighted and selected.
  5. [機能の選択] ページで、[次へ] をクリックします。
  6. [インストール オプションの確認] ページで、[インストール] をクリックします。
  7. [結果] ページで、 [閉じる]をクリックします。

Windows 8 または Windows 8.1

  1. [スタート] 画面で、ポインターを左下隅まで移動し、[スタート] ボタンを右クリックし、[コントロール パネル] を選択します。
  2. [コントロール パネル][プログラムと機能] を選択し、[Windows の機能の有効化または無効化] を選択します。
  3. [インターネット インフォメーション サービス][World Wide Web サービス][アプリケーション開発機能] の順に展開し、[CGI] または [ISAPI 拡張機能] を選択します。
    Screenshot of the I S A P I folder being selected and highlighted.
  4. OK をクリックします。
  5. 閉じるをクリックします。

Windows Server 2008 または Windows Server 2008 R2

  1. タスク バーで [スタート] を選択し、[管理ツール] をポイントして、[サーバー マネージャー] を選択します。
  2. [サーバー マネージャー] 階層ウィンドウで [ロール] を展開し、[Web サーバー (IIS)] を選択します。
  3. [Web サーバー (IIS)] ウィンドウで、[役割サービス] セクションまでスクロールし、[役割サービスの追加] を選択します。
  4. 役割サービスの追加ウィザード[役割サービスの選択] ページで [CGI] または [ISAPI 拡張機能] を選択します。
    Screenshot of the Select Role Services wizard showing the I S A P I Extensions option being highlighted and selected.
  5. [役割サービスの追加] ダイアログが表示されたら、[必要な役割サービスの追加] を選択します。 (このページは、前提条件となる役割サービスをサーバーにまだインストールしていない場合にのみ表示されます)。
  6. [役割サービスの選択] ページで、[次へ] を選択します。
  7. [インストール オプションの確認] ページで、[インストール] をクリックします。
  8. [結果] ページで、 [閉じる]をクリックします。

Windows Vista または Windows 7

  1. タスク バーで、[スタート][コントロール パネル] の順に選択します。
  2. [コントロール パネル][プログラムと機能] を選択し、[Windows の機能の有効化または無効化] を選択します。
  3. [Windows 機能] ダイアログ ボックスで、[インターネット インフォメーション サービス][World Wide Web サービス][アプリケーション開発機能] の順に展開します。
  4. [CGI] または [ISAPI 拡張機能] を選択し、[OK] を選択します。
    Screenshot of the C G I and I S A P I Extensions folders being selected.

操作方法

ISAPI または CGI の制限を追加する方法

  1. インターネット インフォメーション サービス (IIS) マネージャーを開きます。

    • Windows Server 2012 または Windows Server 2012 R2 を使用している場合:

      • タスク バーで、[サーバー マネージャー] を選択し、[ツール][インターネット インフォメーション サービス (IIS) マネージャー] の順に選択します。
    • Windows 8 または Windows 8.1 を使用している場合:

      • Windows キーを押しながら文字 X を押し、[コントロール パネル] を選択します。
      • [管理ツール] を選択し、[インターネット インフォメーション サービス (IIS) マネージャー] をダブルクリックします。
    • Windows Server 2008 または Windows Server 2008 R2 を使用している場合:

      • タスク バーで、[スタート] ボタンを選択し、[管理ツール][インターネット インフォメーション サービス (IIS) マネージャー] の順に選択します。
    • Windows Vista または Windows 7 を使用している場合:

      • タスク バーで、[スタート][コントロール パネル] の順に選択します。
      • [管理ツール] をダブルクリックし、[インターネット インフォメーション サービス (IIS) マネージャー] をダブルクリックします。
  2. [接続] ウィンドウで、サーバー名を選択します。

  3. [ホーム] ウィンドウで、[ISAPI および CGI の制限] をダブルクリックします。
    Screenshot of the SERVER Home pane with the I S A P I and C G I Restrictions option being highlighted.

  4. [操作] ウィンドウで、[追加] を選択します。

  5. [Add ISAPI or CGI Restriction]\(ISAPI または CGI の制限の追加\) ダイアログ ボックスで、ISAPI または CGI パス ボックスに追加するバイナリへのパスを入力し、[説明] ボックスにバイナリの説明を入力し、[Allow extension path option to execute]\(実行する拡張パスを許可する\) チェック ボックスをオンにして、バイナリをサーバー上で実行できるようにし、[OK] を選択します。
    Screenshot of the Add I S A P I or C G I Restriction dialog box.

構成

<isapiCgiRestriction> コレクションは、ApplicationHost.config ファイルのサーバー レベルでのみ構成できます。

属性

属性 説明
allowed 必須のブール型属性。

制限によって、CGI または ISAPI モジュールをサーバー上で実行することを許可または拒否するかどうかを指定します。

既定値の完全な一覧については、以下の「既定の構成」セクションを参照してください。
説明 省略可能な文字列属性。

この groupID に関連付けられているグループのわかりやすい説明を指定します。

既定値の完全な一覧については、以下の「既定の構成」セクションを参照してください。
groupId 省略可能な文字列属性。

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

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

サーバーのファイル システム内の CGI または ISAPI モジュールへのパスを指定します。

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

子要素

なし。

構成サンプル

次の構成例は、ASP と ASP.NET バージョン 2.0 をインストールした後の IIS 7.0 の <isapiCgiRestriction> 要素構成です。

<isapiCgiRestriction>
   <add allowed="true" groupId="ASP"
      path="%windir%\system32\inetsrv\asp.dll"
      description="Active Server Pages" />
   <add allowed="true" groupId="ASP.NET v2.0.50727"
      path="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll"
      description="ASP.NET v2.0.50727" />
</isapiCgiRestriction>

サンプル コード

次の例では、C:\Inetpub\www.contoso.com\wwwroot 内の Web サイトのコンテンツ フォルダーにあるカスタム ISAPI 拡張機能の ISAPI/CGI 制限を追加します。 この例では、ISAPI 拡張機能の名前、パス、グループを指定し、拡張機能を有効にします。

AppCmd.exe

appcmd.exe set config -section:system.webServer/security/isapiCgiRestriction /+"[path='C:\Inetpub\www.contoso.com\wwwroot\isapi\custom.dll',allowed='True',groupId='ContosoGroup',description='Contoso Extension']" /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 isapiCgiRestrictionSection = config.GetSection("system.webServer/security/isapiCgiRestriction");
         ConfigurationElementCollection isapiCgiRestrictionCollection = isapiCgiRestrictionSection.GetCollection();

         ConfigurationElement addElement = isapiCgiRestrictionCollection.CreateElement("add");
         addElement["path"] = @"C:\Inetpub\www.contoso.com\wwwroot\isapi\custom.dll";
         addElement["allowed"] = true;
         addElement["groupId"] = @"ContosoGroup";
         addElement["description"] = @"Contoso Extension";
         isapiCgiRestrictionCollection.Add(addElement);

         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 isapiCgiRestrictionSection As ConfigurationSection = config.GetSection("system.webServer/security/isapiCgiRestriction")
      Dim isapiCgiRestrictionCollection As ConfigurationElementCollection = isapiCgiRestrictionSection.GetCollection

      Dim addElement As ConfigurationElement = isapiCgiRestrictionCollection.CreateElement("add")
      addElement("path") = "C:\Inetpub\www.contoso.com\wwwroot\isapi\custom.dll"
      addElement("allowed") = True
      addElement("groupId") = "ContosoGroup"
      addElement("description") = "Contoso Extension"
      isapiCgiRestrictionCollection.Add(addElement)

      serverManager.CommitChanges()
   End Sub
End Module

JavaScript

var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
var isapiCgiRestrictionSection = adminManager.GetAdminSection("system.webServer/security/isapiCgiRestriction", "MACHINE/WEBROOT/APPHOST");
var isapiCgiRestrictionCollection = isapiCgiRestrictionSection.Collection;

var addElement = isapiCgiRestrictionCollection.CreateNewElement("add");
addElement.Properties.Item("path").Value = "C:\\Inetpub\\www.contoso.com\\wwwroot\\isapi\\custom.dll";
addElement.Properties.Item("allowed").Value = true;
addElement.Properties.Item("groupId").Value = "ContosoGroup";
addElement.Properties.Item("description").Value = "Contoso Extension";
isapiCgiRestrictionCollection.AddElement(addElement);

adminManager.CommitChanges();

VBScript

Set adminManager = createObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
Set isapiCgiRestrictionSection = adminManager.GetAdminSection("system.webServer/security/isapiCgiRestriction", "MACHINE/WEBROOT/APPHOST")
Set isapiCgiRestrictionCollection = isapiCgiRestrictionSection.Collection

Set addElement = isapiCgiRestrictionCollection.CreateNewElement("add")
addElement.Properties.Item("path").Value = "C:\Inetpub\www.contoso.com\wwwroot\isapi\custom.dll"
addElement.Properties.Item("allowed").Value = True
addElement.Properties.Item("groupId").Value = "ContosoGroup"
addElement.Properties.Item("description").Value = "Contoso Extension"
isapiCgiRestrictionCollection.AddElement(addElement)

adminManager.CommitChanges()