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.
Did you installed on 'computername' - msdeploy agent service?
To install it - you must:
1) download package from iis.net
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)
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...
Just had this issue on an IIS 10 server.
Our remote deploy from CI was returning the following error:
This occurred after a maintenance window we performed a few nights ago, installing windows updates and rebooting the server. The management service was online and I attempted to restart it however it did not allow deployments to work.
The SSL certificate in use did not expire until 2027 and appeared to be linked to the service correctly. Thanks to @David-Montgomery comment above, this lead me in the right direction.
Following this, the management service appears to be rebound to the SSL certificate and deployments work again.
TLDR: for some reason the WMSVC service lost it's connection to the SSL certificate even though the UI showed it as linked?