此疑難排解員中使用的工具:
- NA
此資料僅供參考之用。 Microsoft 不做任何明示或暗示的保證。
概觀
下列步驟將逐步解說嘗試從 Visual Studio 發佈至尚未透過 Web Deploy 正確設定的伺服器時,可能會遇到的一系列錯誤。 若要收集下列螢幕擷取畫面和錯誤,我在 Visual Studio 2010 SP1 中使用了新的 ASP.Net MVC 3 專案。 目的地伺服器是 WINDOWS Server 2008 R2 SP1 與 IIS 的全新安裝。 未完成其他設定。
「無法連線」錯誤
您可能會遇到的第一個錯誤看起來會像 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 伺服器上,開啟 Internet Information Services Manager,然後選取電腦名稱稱節點。 在 [功能] 檢視中,向下捲動至 [管理] 區段並尋找下列圖示:
如果沒有,您必須透過 [新增角色服務] 對話方塊來安裝管理服務。 它也可以透過 [Web 平臺安裝程式] 從 [產品] 索引標籤安裝。選取左側欄中的 [伺服器],然後選擇 [IIS:管理服務]。 請注意,安裝管理服務之後,您必須啟動它,因為它不會自動啟動。 若要這樣做,請按兩下 [管理服務] 圖示。 顯示 [管理服務] 窗格之後,按一下右側 [動作] 窗格中的 [啟動]。
Web 管理服務是否已允許透過 Windows 防火牆? 當您在伺服器上安裝 Web 管理服務時,名為 Web Management Service 的輸入防火牆規則 (HTTP 流量) 。 移至 [開始系統 > 管理][工具- > 具有進階安全性的 Windows 防火牆],確認此規則已啟用。 按一下 [輸入規則],然後在清單中尋找 Web 管理規則。 所有設定檔都應該啟用它。 如果您使用協力廠商防火牆,則必須確保允許埠 8172 上的輸入連線。
服務 URL 是否正確?
根據預設,Web 管理服務會接聽埠 8172,但可以變更。 檢查所使用的埠最簡單的方式是開啟上述的 [管理服務] 窗格,並查看 [連線] 區段中的 IP 和埠資訊。 如果埠已變更為 8172 以外的內容,您必須確保允許透過防火牆的新埠,並更新 Visual Studio 發佈設定中的服務 URL 以使用新的埠。
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 Management Service 以排清記錄檔。
在 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
記錄檔中 403 之後的 「6」 是子狀態碼,表示「IP 位址遭到拒絕」。 (可以找到 IIS 狀態和子狀態碼的完整清單 https://support.microsoft.com/kb/943891
管理服務是否已設定為允許遠端連線?
這是 403.6 回應最有可能的原因。 按兩下 [管理服務] 圖示,並確認已核取 [啟用遠端連線]。 您必須停止服務進行變更,因此請務必在完成時重新開機。
是否已針對管理服務設定 IP 限制?
您可能會收到 403 錯誤的另一個常見原因是管理服務已設定為拒絕用戶端的 IP。 根據預設,只要允許遠端連線,它就會設定為允許所有 IP。 您可以按兩下 [管理服務] 圖示來檢查 IP 限制。 任何設定的 IP 限制規則都會位於頁面底部的 IPv4 位址限制中
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 嘗試連線到哪些資源。 您應該會在 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 Deploy 要求的處理常式。
是否已安裝 Web Deploy?
您可以移至 [程式和功能] 控制台,並在已安裝的程式清單中尋找 Microsoft Web Deploy 2.0,以確認已安裝的 Web 部署是否已安裝。 如果不存在,您可以移至 [產品] 索引標籤,透過 Web 平臺安裝程式進行安裝。它列為 Web 部署工具 2.1。 您也應該確定 MsDepSvc) 正在執行 Web Deployment Agent 服務 (。
是否已安裝 Web 部署處理常式?
如果已安裝 Web Deploy,但仍收到此錯誤,請確定已安裝 Web Deploy 中的IIS 7 Deployment Handler功能。 在 [程式和功能] 控制台中,尋找 Microsoft Web Deploy 2.0,以滑鼠右鍵按一下並選擇 [變更]。 在出現的精靈中,按一下第一頁上的 [下一步],然後在第二個頁面上選擇 [變更]。 新增IIS 7 Deployment Handler及其下的所有專案。
按 [下一步] 完成精靈。 進行這項變更之後,您必須重新開機 Web 管理服務。
委派規則的錯誤
一旦正確設定 Web 部署和 Web 管理服務之後,您必須設定委派規則以允許使用者更新內容。 針對許可權問題,您可能會在 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
若要允許此使用者發佈,您必須根據在 的指示設定委派 https://www.iis.net/learn/publish/using-web-deploy/configure-the-web-deployment-handler
如果帳戶能夠登入,但尚未獲得發佈內容所需的許可權,您會看到
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。
針對此特定錯誤,事件記錄檔包含額外的詳細資料, (為了簡潔) 而截斷:
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 中看到的另一個許可權錯誤是
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 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: 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 沒有設定安全性資訊的許可權。 在此情況下,使用者沒有內容的 Modify 許可權。 將「變更許可權」授與內容可解決問題。