我正在尝试使用MSBuild将Web项目发布到远程IIS 7服务器,但当我运行以下使用MSDeployPublishMethod发布方法的MSBuild命令时失败:
MSBuild Projects="[项目文件]" Properties="DeployOnBuild=True; DeployTarget=MsDeployPublish; CreatePackageOnPublish=True; MSDeployPublishMethod=WMSVC; MSDeployServiceUrl=http://localhost:8172/MsDeploy.axd; DeployIisAppPath=Default Web Site/[我的网站]; UserName=[用户名]; Password=[密码]"> /MSBuild
错误: error : Could not complete the request to remote agent URL 'https://http//localhost:8172/MsDeploy.axd?site=Default Web Site'。
该URL似乎以https为前缀,虽然我可以通过Visual Studio指定http并通过IDE成功发布,但没有办法指定http。
当我将URL指定为https://时,仍会发生同样的错误。
错误:
无法完成对远程代理URL'https://localhost:8172/MsDeploy.axd?site=Default Web Site'的请求。
使用InProc的MSDeployPublishMethod选项可以在本地运行MSBuild命令,但此选项不允许远程部署。
MSBuild命令:
MSBuild Projects="[项目文件]" Properties="DeployOnBuild=True; DeployTarget=MsDeployPublish; CreatePackageOnPublish=True; MSDeployPublishMethod=InProc; MSDeployServiceUrl=localhost; DeployIisAppPath=Default Web Site/[我的网站]; UserName=[用户名]; Password=[密码]"> /MSBuild>
我还尝试使用MSDeployPublishMethod为RemoteAgent,但会导致以下错误:
错误:
无法联系远程代理(URL http://localhost/MsDeployAgentService)。
请确保目标计算机上安装并启动了远程代理服务。
MSBuild命令如下:
MSBuild命令:
MSBuild 项目="[项目文件]" 属性="DeployOnBuild=True; DeployTarget=MsDeployPublish; MSDeployPublishMethod=RemoteAgent; AllowUntrustedCertificated=True; MSDeployServiceUrl=http://localhost/MsDeployAgentService; DeployIisAppPath=Default Web Site/[我的网站]; UserName=[用户名]; Password=[密码]"> /MSBuild>
我错过了什么?