Web Deployment Handler の構成

発行日 : 2008 年 10 月 29 日 (作業者 : faith_a(英語))
更新日 : 2008 年 10 月 29 日 (作業者 : faith_a(英語))

このクイック ガイドでは、ホストされたサーバーで Web Deployment Handler を構成する方法、および Web サイトへ展開できることをテストする方法の簡単な概要を説明します。このセットアップでは、このドキュメントの情報を使用して、Web 配置ツールの新しいサーバーへのインストール、推奨された設定の構成、および作成されたルールの評価を行います。

前提条件

このガイドの前提条件ソフトウェアは以下のとおりです。

  • .NET Framework 2.0 SP1 以降
  • Web 配置ツール(RC版)
  • Web 管理サービスがインストールされた IIS 7.0

注 : Web 配置ツールをまだインストールしていない場合は、「Web 配置ツールのインストール」を参照してください。 

パート 1 - サーバーのセットアップと展開

1. Windows Server 2008 サーバーに IIS 7.0 と Web 管理サービスをインストールします。

2. Web サイトの準備が整ったら、Web サイトへの適切なユーザー アカウントに対して委任アクセス権を設定します。

a) その他の情報 : https://technet.microsoft.com/ja-jp/library/cc770968.aspx

3. Web 配置ツールをダウンロードし、Web サーバーにインストールします。

4. ユーザーが、コンテンツ、アプリケーション、および SQL データベースを展開できるように、下記の「MWA を用いた委任ルールの追加」に従って、一連のルールを追加します。

5. createApp ルールを機能させるには (単純に、フォルダーがアプリケーションとしてマークされ、親サイトからすべてのプロパティを継承できるようにします)、次の手順を実行します。

a) ユーザー アカウントを作成します。

b) %windir%\system32\inetsrv\config に読み取りアクセス許可を付与します。

b) %windir%\system32\inetsrv\config\applicationHost.config に変更のアクセス許可を付与します。

6. サーバー上のログを有効にします。

a) HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WebManagement\Server に TracingEnabled という名前の DWORD を作成します。

b) TracingEnabled に 1 を設定します。

7. WMSVC を再起動します。

MWA を用いた委任ルールの追加

1. メモ帳を使用して、次のコードをテキスト ファイルに追加し、DelegationRules.cs として保存します。

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

internal static class CreateDelegationRules {

private static void Main() {

using(ServerManager serverManager = new ServerManager()) { 
//administration.config を開いて編集
Configuration config = serverManager.GetAdministrationConfiguration();

//委任セクションの取得
ConfigurationSection delegationSection = config.GetSection("system.webServer/management/delegation");

ConfigurationElementCollection delegationCollection = delegationSection.GetCollection();

//iisapp と contentpath プロバイダー用の新しいルールの作成
ConfigurationElement ruleElement = delegationCollection.CreateElement("rule");
ruleElement["providers"] = @"iisapp,contentPath";
ruleElement["actions"] = @"*";
ruleElement["path"] = @"{userScope}";
ruleElement["pathType"] = @"PathPrefix";

//ルール要素内で、アクセス許可のコレクションを取得
ConfigurationElementCollection permissionsCollection = ruleElement.GetCollection("permissions");

//ユーザー名とアクセスの種類を追加
ConfigurationElement userElement = permissionsCollection.CreateElement("user");
userElement["name"] = @"*";
userElement["accessType"] = @"Allow";
permissionsCollection.Add(userElement);

//RunAs を設定 (このケースでは現在のユーザー) 
ConfigurationElement runAsElement = ruleElement.GetChildElement("runAs");
runAsElement["identityType"] = @"CurrentUser";
delegationCollection.Add(ruleElement);

//createapp プロバイダー用の新しいルールの作成
ConfigurationElement ruleElement1 = delegationCollection.CreateElement("rule");
ruleElement1["providers"] = @"createapp";
ruleElement1["actions"] = @"*";
ruleElement1["path"] = @"{userScope}";
ruleElement1["pathType"] = @"PathPrefix";

//ルール要素内で、アクセス許可のコレクションを取得
ConfigurationElementCollection permissionsCollection1 = ruleElement1.GetCollection("permissions");
//ユーザー名とアクセスの種類を追加
ConfigurationElement userElement1 = permissionsCollection1.CreateElement("user");
userElement1["name"] = @"*";
userElement1["accessType"] = @"Allow";
permissionsCollection1.Add(userElement1);

//RunAs を設定 (このケースでは、ユーザー名とパスワードを持つ特定のユーザー) 
ConfigurationElement runAsElement1 = ruleElement1.GetChildElement("runAs");
runAsElement1["identityType"] = @"SpecificUser";
runAsElement1["userName"] = @"UserName";
runAsElement1["password"] = @"Password";
delegationCollection.Add(ruleElement1);

//dbFullSql プロバイダー用の新しいルールの作成
ConfigurationElement ruleElement2 = delegationCollection.CreateElement("rule");
ruleElement2["providers"] = @"dbFullSql";
ruleElement2["actions"] = @"*";
ruleElement2["path"] = @"";
ruleElement2["pathType"] = @"StringPrefix";
//ルール要素内で、アクセス許可のコレクションを取得
ConfigurationElementCollection permissionsCollection2 = ruleElement2.GetCollection("permissions");
//ユーザー名とアクセスの種類を追加
ConfigurationElement userElement2 = permissionsCollection2.CreateElement("user");
userElement2["name"] = @"*";
userElement2["accessType"] = @"Allow";
permissionsCollection2.Add(userElement2);

//RunAs を設定 (このケースでは現在のユーザー)
ConfigurationElement runAsElement2 = ruleElement2.GetChildElement("runAs");
runAsElement2["identityType"] = @"CurrentUser";
delegationCollection.Add(ruleElement2);

//構成への変更のコミット
serverManager.CommitChanges();
}
}
}

2. 管理コマンド プロンプトを開き、%windir%\Microsoft.NET\{Framework のバージョン}\ ディレクトリに移動します。

3. 以下のコマンドを実行し、コードをコンパイルします。

csc /reference Microsoft.Web.Administration.dll /out:DelegationRules.exe DelegationRules.cs 

4. コンパイルした実行可能ファイルを実行します。

IIS マネージャーを使用したサーバーのテスト

IIS マネージャーを使用したパッケージの作成

1. 展開するアプリケーションを含む Web サイトに移動します。

2. 「IIS マネージャーを使用したパッケージのエクスポート」の指示に従います。

IIS マネージャーを使用したパッケージのインストール

1. Web 配置ツールをダウンロードし、クライアントにインストールするか、ローカル サーバーを使用します。

2. IIS マネージャーを開きます。

3. リモート Web サイトに接続します。

4. 「IIS マネージャーを使用したパッケージのインポート」の指示に従います。

まとめ

このガイドでは、Web 配置ツールと Web Deployment Handler のインストールと構成方法、およびリモートでのパッケージの作成とインストールについて説明しました。