MSDeploy失败,“远程主机强行关闭现有连接”

时间:2011-01-26 15:00:41

标签: msdeploy

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

2 个答案:

答案 0 :(得分:4)

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

解决方案是明确指定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"

答案 1 :(得分:0)

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