Msdeploy

MSDeploy 失敗並顯示“現有連接被遠端主機強行關閉”

  • March 6, 2019

提供給命令行的以下 MSDeploy 字元串會導致錯誤。任何人都可以對此有所了解嗎?

"C:\Program Files\IIS\Microsoft Web Deploy\\msdeploy.exe" -source:package='D:\dev\Project\obj\BuildConfiguration\Package\Project.zip' -dest:auto='Website Name',computerName='computername',userName='username',password='password' -verb:sync -enableRule:DoNotDeleteRule -allowUntrusted -debug

堆棧跟踪:

Microsoft.Web.Deployment.DeploymentAgentUnavailableException: Could not complete the request to remote agent URL 'http://computername/MSDEPLOYAGENTSERVICE'.
---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)   
--- End of inner exception stack trace ---    at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)    at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)    at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)    --- End of inner exception stack trace ---    at System.Net.HttpWebRequest.GetResponse() at Microsoft.Web.Deployment.AgentClientProvider.GetHttpResponse(HttpWebRequest request)    --- End of inner exception stack trace ---    at Microsoft.Web.Deployment.AgentClientProvider.GetHttpResponse(HttpWebRequest request)    at Microsoft.Web.Deployment.AgentClientProvider.CreateStatusThread(DeploymentSyncContext syncContext)    at Microsoft.Web.Deployment.AgentClientProvider.RemoteDestSync(DeploymentObject sourceObject, DeploymentSyncContext syncContext)    at Microsoft.Web.Deployment.DeploymentObject.SyncToInternal(DeploymentObject destObject, DeploymentSyncOptions syncOptions, PayloadTable payloadTable, ContentRootTable contentRootTable)    at Microsoft.Web.Deployment.DeploymentObject.SyncTo(DeploymentProviderOptions providerOptions, DeploymentBaseOptions baseOptions, DeploymentSyncOptions syncOptions)    at MSDeploy.MSDeploy.ExecuteWorker() Error count: 1.

您是否安裝在“電腦名”-msdeploy 代理服務上?

要安裝它 - 您必須:

  1. 從 iis.net 下載軟體包

  2. 安裝管理服務(用於 DEST 伺服器上的 IIS)

  3. 配置管理服務(允許通過 ip 進行某些操作,注意:至少需要一個條目)

4 ) 啟動管理服務

  1. 啟動代理服務

  2. 嘗試部署

我確定它應該可以工作(我在第一次嘗試使用 msdeploy 時遇到了這個錯誤)

當管理服務使用的證書對伺服器無效時,我還看到了此“強制斷開連接”錯誤消息。

就我而言,我創建了一個標準的 Web 伺服器 VM,然後複製了一個經過系統準備的 VM 版本。複製 VM 上的管理服務仍顯示原始 VM 頒發的證書。

用自簽名證書替換壞證書可以立即解決問題。

最初我花了幾分鐘才弄清楚那個…

引用自:https://serverfault.com/questions/227128