MSDeploy 失败并显示“现有连接被远程主机强制关闭”

发布于 2024-10-14 23:13:09 字数 2286 浏览 6 评论 0原文

提供给命令行的以下 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.

The following MSDeploy string supplied to the command line results in an error. Can anyone shed any light on this?

"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

Stack trace:

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

平定天下 2024-10-21 23:13:09

原因是多种原因造成的 - 内部 DNS 解析问题,意味着主机名解析为错误的 IP,加上我们必须使用 IIS6,而且我相信 msdeploy 所需的 http 代理托管存在问题与现有网站相同的端口。

解决方案是显式指定 IP,并从命令行重新安装部署服务 (WebDeploy),指定自定义端点以避免 IIS 冲突。

我的工作咒语:

"C:\Program Files\IIS\Microsoft Web Deploy\msdeploy.exe" -verb:sync -source:package=D:\Path\obj\Configuration\Package\Project.zip -dest:auto,computerName='http://192.168.x.xxx:8090/MsDeployAgentService2/' -allowUntrusted  -setParam:"IIS Web Application Name"="Website Name In IIS"

The cause was a mixture of things - an internal DNS resolution issue, meant the hostname was resolving to the wrong IP, plus we have to use IIS6, and I believe there to be a problem with the hosting of the http agent required for msdeploy on the same port as existing websites.

The resolution was to specify the IP expicitly, and re-install the deployment service (WebDeploy) from the command line, specifying a custom endpoint to avoid the IIS conflict.

My working incantation:

"C:\Program Files\IIS\Microsoft Web Deploy\msdeploy.exe" -verb:sync -source:package=D:\Path\obj\Configuration\Package\Project.zip -dest:auto,computerName='http://192.168.x.xxx:8090/MsDeployAgentService2/' -allowUntrusted  -setParam:"IIS Web Application Name"="Website Name In IIS"
宣告ˉ结束 2024-10-21 23:13:09

“msdeploy.exe 错误:0...System.IO.IOException:无法写入...连接被远程主机强制关闭...”错误的另一个可能原因是指二进制网站文件之一是否正在运行,因此无法被覆盖。即使当前只有 1 个 .dll 文件正在写入日志文件,也可能会发生这种情况。一种解决方案是停止网站,然后执行 MSDeploy,尽管这不是最佳解决方案,因为在生产中您不能让网站在部署新版本时关闭几分钟...

Another possible cause of the "msdeploy.exe Error: 0....System.IO.IOException: Unable to write....connection was forcibly closed by the remote host...." error is if one of the binary website files is actively running and therefore cannot be overwritten. This could happen if even just 1 .dll file is currently writing to a log file. One solution is to stop the website, then do the MSDeploy, although that is not an optimal solution b/c in production you cannot let the website be down for a couple minutes while the new version is deployed...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文