从命令行部署 Ms

Ms deploy from the command line

好的构建代码并在详细构建期间通过上下文菜单上的发布选项从 VS 中提取命令详细信息并清理它,提取命令我将命令带到我的构建服务器,这恰好是与我目前的测试网络框相同的框并更改了路径。

来自团队服务的 MSBuild 运行 args“/p:DeployOnBuild=true;PublishProfile=Test;DeployTarget=package”因此它为每个 Web 应用程序生成一个包。

这与 VS 的方式略有不同,这意味着我必须调整源参数,所以我 运行 从命令行执行以下操作(添加格式以提高可读性)...

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

...这让我得到了以下回应...

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.

... 将 "localhost" 替换为指向服务器的域名(我用来远程访问的服务器)导致 ...

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.

...奇怪,因为我可以远程访问域中的机器,但由于某种原因我无法与它上面的 MSDeploy 交谈,即使我确实从本地机器明确地与它交谈,它似乎不开心。

这里有我遗漏的魔法吗?

将您的计算机名称更改为 "localhost"。

根据这里的回答...是的,这太愚蠢了,一点都不好笑。

除了使用查找 iis express 实例的 /L 参数外,MSDeploy 似乎无法部署到本地计算机。