Visual Studio での Web 配置に関する問題のトラブルシューティング

適用対象: インターネット インフォメーション サービス

この記事は、Visual Studio から Web 配置を介して正しく構成されていないサーバーに発行しようとするときの一連のエラーのトラブルシューティングに役立ちます。 この記事は特定の製品バージョン用に記述されていますが、概念は新しいバージョンにも適用できます。

次のスクリーンショットとエラーを収集するには、Visual Studio 2010 SP1 の新しい ASP.Net MVC 3 プロジェクトを使用します。 移行先サーバーは、インターネット インフォメーション サービス (IIS) を使用した Windows Server 2008 R2 SP1 のクリーンインストールでした。 他の構成は行われませんでした。

サーバーに接続できない

最初に発生する可能性があるエラーは、Visual Studio の出力ウィンドウの次のスクリーンショットのようになります。 読みやすくするために、スクリーンショットの下にメッセージのフルテキストが表示されます。

Visual Studio のエラー一覧の出力を示すスクリーンショット。

Web deployment task failed.(Could not connect to the destination computer ("deployserver").On the destination computer, make sure that Web Deploy is installed and that the required process("The Web Management Service") is started.)
This error indicates that you cannot connect to the server. Make sure the service URL is correct,firewall and network settings on this computer and on the server computer are configured properly,and the appropriate services have been started on the server.
Error details:
Could not connect to the destination computer ("deployserver"). On the destination computer,
make sure that Web Deploy is installed and that the required process
("The Web Management Service") is started.
Unable to connect to the remote server
A connection attempt failed because the connected party did not properly respond after a period
of time, or established connection failed because connected host has failed to respond 1.1.1.1:8172

このエラーで強調表示されているテキスト (および以下の他のエラー) は、問題の性質を理解するための鍵です。 Web Deploy はサーバーから応答を受け取らなかったため、Visual Studio では考えられるいくつかの原因を区別できません。 その結果、試してみることの一覧が表示されます。

Web 管理サービスはインストールされていますか?

IIS サーバーで、 インターネット インフォメーション サービス (IIS) マネージャー を開き、コンピューター名ノードを選択します。 [ 機能 ] ビューで、[ 管理 ] セクションまで下にスクロールし、次のアイコンを探します。

[IIS マネージャーのアクセス許可] アイコン、IIS マネージャー の [ユーザー] アイコン、および [管理サービス] アイコンを示すスクリーンショット。

存在しない場合は、[役割サービスの追加] ダイアログを使用して管理 サービス をインストールする必要があります。 また、[ 製品 ] タブから Web プラットフォーム インストーラーを使用してインストールすることもできます。左側の列で [ サーバー ] を選択し、[ IIS: 管理サービス] を選択します。

注:

管理サービスをインストールした後は、自動的に開始されないため、開始する必要があります。 これを行うには、[ 管理サービス ] アイコンをダブルクリックします。 [管理サービス] ウィンドウが表示されたら、右側の [操作] ウィンドウで [開始] を選択します。

サービス URL は正しいですか?

既定では、Web 管理サービスはポート 8172 でリッスンしますが、これは変更できます。 使用されているポートをチェックする最も簡単な方法は、前述のように [管理サービス] ウィンドウを開き、[Connections] セクションの IP とポートの情報を確認することです。 ポートが 8172 以外に変更された場合は、ファイアウォール経由で新しいポートが許可されていることを確認し、Visual Studio の発行設定でサービス URL を更新して新しいポートを使用する必要があります。

(403) 禁止

Web 管理サービスがインストールされると、Visual Studio に次のエラーが表示される場合があります。

Visual Studio の [エラー一覧] 画面を示すスクリーンショット。

Web deployment task failed.(Could not connect to the destination computer ("deployserver") using
the specified process ("The Web Management Service") because the server did not respond.
Make sure that the process ("The Web Management Service") is started on the destination computer.)
Could not connect to the destination computer ("deployserver") using the specified process
("The Web Management Service") because the server did not respond. Make sure that the process
("The Web Management Service") is started on the destination computer.
The remote server returned an error: (403) Forbidden.

このメッセージはやや誤解を招きます。 サーバーが応答しなかったことを示しますが、403 エラーは、Web Deploy がサーバーに接続できたが、要求がアクティブに拒否されたことを示しています。 Web 管理サービスの HTTP ログは、要求がサーバーに到達したことを確認し、失敗した実際の要求に関する詳細を提供するのに役立ちます。 このログは、既定で %SystemDrive%\Inetpub\logs\WMSvc 見つけることができます。 他の IIS ログと同様に、データはすぐにはログに書き込まれないため、要求が表示されるまで数分待つか、Web 管理サービスを再起動してログをフラッシュする必要がある場合があります。

ログでは WMSVC 、上記のエラーは次のようになります。

2011-06-02 17:59:05 192.168.0.211 POST /msdeploy.axd site=default%20web%20site 8172 - 192.168.0.203 - 403 6 5 1669

6ログ内の の403後の はサブステータス コードであり、IP アドレスが拒否されたことを意味します。 IIS の状態コードとサブ状態コードの完全な一覧は、IIS の HTTP 状態コードにあります

管理サービスはリモート接続を許可するように構成されていますか?

これが 403.6 応答の最も可能性の高い理由です。 [管理サービス] アイコンをダブルクリックし、[リモート Connectionsを有効にする] がオンになっていることを確認します。 サービスを停止して変更を加える必要があるため、完了したら必ず再起動してください。

[管理サービス] ダイアログ ボックスを示すスクリーンショット。

Web 管理サービスは Windows ファイアウォール経由で許可されていますか?

サーバーに Web 管理サービスをインストールすると、受信ファイアウォール規則の名前は Web Management Service (HTTP Traffic-In) になります。 [管理][セキュリティが強化された Windows ファイアウォール開始>]> に移動して、この規則が有効になっていることを確認します。 [ 受信規則] を 選択し、一覧から Web 管理 規則を見つけます。 すべてのプロファイルで有効にする必要があります。

サード パーティ製ファイアウォールを使用している場合は、ポート 8172 での受信接続が許可されていることを確認する必要があります。

管理サービスに対して IP 制限が構成されていますか?

403 エラーが発生する可能性があるもう 1 つの一般的な理由は、管理サービスがクライアントの IP を拒否するように構成されている場合です。 既定では、リモート接続が許可されている限り、すべての IP を許可するように構成されています。 IP 制限をチェックするには、[管理サービス] アイコンをダブルクリックします。 構成済みの IP 制限規則は、IPv4 アドレス制限のページの下部にあります。

(404) 見つかりません

Visual Studio の [エラー一覧] ページを示すスクリーンショット。エラーの詳細がフォーカスされています。

Web deployment task failed.(Could not connect to the destination computer ("deployserver").
On the destination computer, make sure that Web Deploy is installed and that the required process
("The Web Management Service") is started.
The requested resource does not exist, or the requested URL is incorrect.
Error details: Could not connect to the destination computer ("deployserver").
On the destination computer, make sure that Web Deploy is installed and that the required process
("The Web Management Service") is started.
The remote server returned an error: (404) Not Found.

404 エラーは、Web Deploy がサーバー上の Web 管理サービスに接続できたが、必要なものが見つからなかったことを示します。 最初に、Web Deploy が接続しようとしたリソースを確認します。 移行先サーバーの %SystemDrive%\Inetpub\logs\WMSvc の下の Web 管理サービス ログを見ると、ログに次のようなエントリ WMSVC が表示されます。

2011-05-12 15:21:50 192.168.0.211 POST /msdeploy.axd site=default%20web%20site 8172 - 192.168.0.203 - 404 7 0 1606

Msdeploy.axd は、Web 配置要求のハンドラーです。

Web Deploy はインストールされていますか?

Web Deploy がインストールされていることを確認するには、[ プログラムと機能 ] コントロール パネルに移動し、インストールされているプログラムの一覧で Microsoft Web Deploy 2.0 を探します。 存在しない場合は、Web プラットフォーム インストーラーから [ 製品 ] タブに移動してインストールできます。 Web 展開ツール 2.1 として一覧表示されます。 また、Web Deployment Agent Service (MsDepSvc) が実行されていることを確認する必要もあります。

Web デプロイ ハンドラーはインストールされていますか?

Web Deploy がインストールされていてもこのエラーが発生する場合は、Web Deploy のIIS 7.0 Deployment Handler機能がインストールされていることを確認してください。 [ プログラムと機能 ] コントロール パネルで、 Microsoft Web Deploy 2.0 を探し、右クリックして [ 変更] を選択します。 表示されるウィザードで、最初のページで [次へ ] を選択し、2 番目のページで [変更 ] を選択します。 IIS 7.0 Deployment Handlerとその下にすべてを追加します。

[Microsoft Web Deploy 2 dot 0 Setup]\(Microsoft Web Deploy 2 dot 0 セットアップ\) ダイアログ ボックスを示すスクリーンショット。Web 配置フレームワークが強調表示されています。

[ 次へ ] を選択してウィザードを完了します。 この変更を行った後、Web 管理サービスを再起動する必要があります。

(401) 未承認

Web 配置と Web 管理サービスが正しく構成されたら、ユーザーがコンテンツを更新できるように委任ルールを設定する必要があります。 アクセス許可の問題については、Visual Studio に表示されるエラーがいくつかあります。 例:

アクセス許可の問題のエラーを表示する Visual Studio のエラー一覧を示すスクリーンショット。

Web deployment task failed.(Connected to the destination computer ("deployserver")
using the Web Management Service, but could not authorize.
Make sure that you are using the correct user name and password, that the site you are connecting
to exists, and that the credentials represent a user who has permissions to access the site.
Make sure the site name, user name, and password are correct. If the issue is not resolved,
please contact your local or server administrator.
Error details:
Connected to the destination computer ("deployserver") using the Web Management Service,
but could not authorize. Make sure that you are using the correct user name and password,
that the site you are connecting to exists, and that the credentials represent a user who
has permissions to access the site.
The remote server returned an error: (401) Unauthorized.

WMSvc ログには、次のメッセージが表示されます。

2011-05-12 15:50:12 192.168.0.211 POST /msdeploy.axd site=default%20web%20site 8172 - 192.168.0.203 - 401 2 5 1653
2011-05-12 15:50:12 192.168.0.211 POST /msdeploy.axd site=default%20web%20site 8172 user1 192.168.0.203 - 401 1 1326 124

Visual Studio の出力で強調表示されている http 状態は、アクセス拒否エラーです。 エラー ログで強調表示されている win32 状態は、"ログオン エラー: 不明なユーザー名または不適切なパスワード" にマップされるため、これは単純なログオン エラーです。 ユーザーが認証されていても、発行に必要な権限がない場合、ログ エントリは次のようになります。

2011-05-12 15:55:38 192.168.0.211 POST /msdeploy.axd site=default%20web%20site 8172 - 192.168.0.203 - 401 2 5 0

このユーザーが発行できるようにするには、「 Web デプロイ ハンドラーの構成」の手順に従って委任を設定する必要があります。

操作が承認されていない

アカウントがログインできても、コンテンツの公開に必要な権限が付与されていない場合は、次のエラー メッセージが表示されます。

Visual Studio の [エラー一覧] ページに、ユーザーのアクセス許可に関連するエラーが表示されているスクリーンショット。

Web deployment task failed. (Unable to perform the operation ("Create Directory")  for the specified
directory ("bin"). This can occur if the server administrator has not authorized this operation for
the user credentials you are using.

ログには、 WMSvc これらの要求に対する HTTP 200 応答が表示されます。 幸いなことに、Web Deploy 2.1 は Microsoft Web Deploy サービス ログにも情報を書き込みます。 表示するには、[イベント ビューアー (ローカル)]>[アプリケーションとサービス ログ>] [Microsoft Web Deploy] の順に選択します。

イベント ビューアー メニューを示すスクリーンショット。Microsoft Web Deploy が強調表示されています。

この特定のエラーの場合、イベント ログには追加の詳細が含まれています (簡潔にするために切り捨てられます)。

User: DEPLOYSERVER\User1
Client IP: 192.168.0.203
Content-Type: application/msdeploy
Version: 8.0.0.0
MSDeploy.VersionMin: 7.1.600.0
MSDeploy.VersionMax: 7.1.1070.1
MSDeploy.Method: Sync
MSDeploy.RequestId: 50de0746-f10d-4640-9b3d-4ba773520e38
MSDeploy.RequestCulture: en-US
MSDeploy.RequestUICulture: en-US
Skip: objectName="^configProtectedData$"
Provider: auto, Path: 
Tracing deployment agent exception. Request ID '50de0746-f10d-4640-9b3d-4ba773520e38'. Request Timestamp: '5/12/2011 9:18:12 AM'. Error Details:
Microsoft.Web.Deployment.DeploymentDetailedUnauthorizedAccessException: Unable to perform the operation ("Create Directory")
for the specified directory ("C:\inetpub\wwwroot\bin"). This can occur if the server administrator has not authorized this
operation for the user credentials you are using.
---> Microsoft.Web.Deployment.DeploymentException: The error code was 0x80070005. ---> System.UnauthorizedAccessException:
Access to the path 'C:\inetpub\wwwroot\bin' is denied.
   at Microsoft.Web.Deployment.Win32Native.RaiseIOExceptionFromErrorCode(Win32ErrorCode errorCode, String maybeFullPath)
   at Microsoft.Web.Deployment.DirectoryEx.CreateDirectory(String path)
   at Microsoft.Web.Deployment.DirPathProvider.CreateDirectory(String fullPath, DeploymentObject source)
   at Microsoft.Web.Deployment.DirPathProvider.Add(DeploymentObject source, Boolean whatIf)
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---

このメッセージは、この特定のエラーに対してアクセス許可を付与する必要がある場所を示します。 Visual Studio で次のアクセス許可エラーが表示される場合もあります。

Visual Studio の [エラー一覧] ページを示すスクリーンショット。アクセス許可エラーがフォーカスされています。

Web deployment task failed.((5/12/2011 11:31:41 AM) An error occurred when the request was processed on the remote computer.)

(5/12/2011 11:31:41 AM) An error occurred when the request was processed on the remote computer.
The server experienced an issue processing the request. Contact the server administrator for more information.

この特定のエラーでは実行する必要はあまりありませんが、イベント ビューアーの Web 配置エラー ログを見ると、画像がより明確になります。

User: DEPLOYSERVER\User1
Client IP: 192.168.0.203
Content-Type: application/msdeploy
Version: 8.0.0.0
MSDeploy.VersionMin: 7.1.600.0
MSDeploy.VersionMax: 7.1.1070.1
MSDeploy.Method: Sync
MSDeploy.RequestId: 63b2f3d1-1817-444f-8280-9fa4f6f85d53
MSDeploy.RequestCulture: en-US
MSDeploy.RequestUICulture: en-US
Skip: objectName="^configProtectedData$"
Provider: auto, Path: 
Tracing deployment agent exception. Request ID '63b2f3d1-1817-444f-8280-9fa4f6f85d53'. Request Timestamp: '5/12/2011 9:31:41 AM'. Error Details:
System.UnauthorizedAccessException: Attempted to perform an unauthorized operation.
   at System.Security.AccessControl.Win32.SetSecurityInfo(ResourceType type, String name, SafeHandle handle, SecurityInfos securityInformation, SecurityIdentifier owner, SecurityIdentifier group, GenericAcl sacl, GenericAcl dacl)
   at System.Security.AccessControl.NativeObjectSecurity.Persist(String name, SafeHandle handle, AccessControlSections includeSections, Object exceptionContext)
   at System.Security.AccessControl.NativeObjectSecurity.Persist(String name, AccessControlSections includeSections, Object exceptionContext)
   at Microsoft.Web.Deployment.FileSystemSecurityEx.Persist(String path)
   at Microsoft.Web.Deployment.SetAclProvider.Add(DeploymentObject source, Boolean whatIf)
   at Microsoft.Web.Deployment.DeploymentObject.Update(DeploymentObject source, DeploymentSyncContext syncContext)
   at Microsoft.Web.Deployment.DeploymentSyncContext.HandleUpdate(DeploymentObject destObject, DeploymentObject sourceObject)
   at Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildrenOrder(DeploymentObject dest, DeploymentObject source)
   at Microsoft.Web.Deployment.DeploymentSyncContext.ProcessSync(DeploymentObject destinationObject, DeploymentObject sourceObject)

この出力から、セキュリティ情報を設定する権限がないことがわかります User1 。 この場合、ユーザーにはコンテンツに対する "変更アクセス許可" がありません。 コンテンツに "アクセス許可の変更" を付与すると、問題が解決されます。

Others

正常に発行された .NET 4.0 アプリケーションを参照できない場合は、.NET 4.0 が IIS に正しく登録されていない可能性があります。 その他の現象として、.NET 4.0 がインストールされていますが、IIS には .NET 4.0 アプリケーション プールまたはハンドラー マッピングが存在しません。 これは、IIS がインストールされる前に .NET 4.0 がインストールされている場合に発生します。 この問題を解決するには、管理者特権でコマンド プロンプトを起動し、次のコマンドを実行します。

%systemdrive%\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -iru

詳細