Ms deploy from the command line

14.1k views Asked by At

Ok built the code and pulled the command details from VS during a verbose build via the publish option on the context menu having cleaned it up, extracted the command I took the command to my build server which just happens to be the same box as my test web box at the moment and changed the paths.

MSBuild from Team services is running with the args "/p:DeployOnBuild=true;PublishProfile=Test;DeployTarget=package" so it spits out a package for each web app.

This being slightly different to how VS does it meant I had to tweak the source param so I ran the following from the command line (formatting added to help readability)...

C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe 
  -source:package='..\API.zip' 
  -dest:auto,ComputerName='https://localhost/MSDEPLOYAGENTSERVICE',UserName='MSDeployUser',Password='********',AuthType='NTLM',IncludeAcls='False' 
  -setParam:name='IIS Web Application Name',value='Api\MyApp'
  -verb:sync 
  -retryAttempts=2 
  -disableLink:AppPoolExtension 
  -disableLink:ContentExtension 
  -disableLink:CertificateExtension

... that got me the following response ...

Info: Using ID '6f5795f6-79bf-49cd-ac27-cc320e3af063' for connections to the rem
ote server.
Error: Could not complete the request to remote agent URL 'https://localhost/MSD
EPLOYAGENTSERVICE'.
Error: The underlying connection was closed: An unexpected error occurred on a s
end.
Error: Unable to read data from the transport connection: An existing connection
 was forcibly closed by the remote host.
Error: An existing connection was forcibly closed by the remote host
Error count: 1.

... replacing "localhost" with the domain name pointing at the server (the one I use to remote in to the box with) results in ...

Info: Using ID 'b4820db6-a975-4a77-96f1-51390bcced37' for connections to the rem
ote server.
Error Code: ERROR_DESTINATION_NOT_REACHABLE
More Information: Could not connect to the remote computer ("<my domain>"). On the remote computer, make sure that Web Deploy is installed and that t
he required process ("Web Deployment Agent Service") is started.  Learn more at:
 http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_DESTINATION_NOT_REACHABLE.
Error: The remote server returned an error: (404) Not Found.
Error count: 1.

... odd since I can remote in to the machine on the domain but I can't talk to MSDeploy on it for some reason, and even when I do talk to it explicitly from the local machine it seems to not be happy.

Is there some wizardry I am missing here?

2

There are 2 answers

0
War On BEST ANSWER

Deploying web packages with MSDEPLOY

As per the answer here ... yup this is so stupid it's not even funny.

MSDeploy can't seemingly deploy to the local machine other than with the /L argument which looks for an iis express instance.

0
chief7 On

Change your computername to just "localhost".