Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSDeploy fails with "an existing connection was forcibly closed by the remote host"

Tags:

msdeploy

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.
like image 846
Ben Aston Avatar asked Jan 26 '11 15:01

Ben Aston


1 Answers

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"
like image 66
Ben Aston Avatar answered Oct 19 '22 12:10

Ben Aston