Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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\' -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.
share|improve this question
up vote 3 down vote accepted

Did you installed on 'computername' - msdeploy agent service?

To install it - you must:
1) download package from
2) install management service (for IIS on DEST server)
3) configure management service (to allow by ip something, note: there is required AT LEAST ONE entry)
4) start management service
5) start agent service
6) try deployment

I'm sure it should work (I've encounter this error when tried to use msdeploy for first time)

share|improve this answer

I've also seen this 'forcibly disconnected' error message when the certificate used by the management service is invalid for the server.

In my case, I created a standard web server VM, then cloned a sysprepped version of the VM. The management service on the cloned VM's was still displaying a certificate issued by the original VM.

Replacing the bad certificate with a self-signed certificate clears the problem right up.

It took me a few minutes to figure that one out initially...

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.