我正在尝试运行在传递参数 /p:DeployOnBuild=True
时由 MSBuild 生成的 ProjectName.deply.cmd。参数“ComputerName”之一将作为 https://WebServer01:8172/MSDeploy.axd?SiteName=MySiteName
传递。我的命令行是
ProjectName.deploy.cmd /Y /M:https://WebServer01:8172/MSDeploy.axd?Site=MySiteName
-AllowUntrusted /U:DeployUserName /P:Password /A:Basic
它返回
Error: Unrecognized argument 'MySiteName'. All arguments must begin with "-".
实际执行的命令是
"C:\Program Files\IIS\Microsoft Web Deploy V3\\msdeploy.exe"
-source:package='Y:\ProjectName.zip'
-dest:auto,computerName='https://WebServer01:8172/MSDeploy.axd?Site',userName='DeployUserName',password='Password',authtype='Basic',includeAcls='False'
-verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension
-disableLink:CertificateExtension
-setParamFile:"Y:\ProjectName.SetParameters.xml"
MySiteName
-AllowUntrusted
请注意,/M
https://WebServer01:8172/MSDeploy.axd?Site=MySiteName
的参数被拆分为两个参数,从而创建 computerName='https://WebServer01:8172/MSDeploy.axd?Site'
和额外的参数 MySiteName
。我已经完成了 Running a deployment package with quoted parameters fails in Visual Studio 2010 Service Pack 1 但它只处理了
ArgMsDeployAdditionalFlags
而不是参数,例如/M:ComputerName
。当 SiteName 未通过时,我可以使用在服务器上具有管理员权限的用户进行部署,但是当使用标准的 IIS 用户 DeployUserName 时,我得到 401
ProjectName.deploy.cmd /Y /M:https://WebServer01:8172/MSDeploy.axd
-AllowUntrusted /U:DeployUserName /P:Password /A:Basic
服务器返回401
Error Code: ERROR_USER_UNAUTHORIZED
More Information: Connected to the remote computer ("WebServer01") using the Web
Management Service, but could not authorize. Make sure that you are using the
correct user name and password, that the site you are connecting to exists, and
that the credentials represent a user who has permissions to access the site.
Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_UNAUTHORIZED.
Error: The remote server returned an error: (401) Unauthorized.
该用户的权限很好,因为使用该用户从
VS2012
和 MSDeploy
配置文件发布工作正常。我还可以构建 msdeploy.exe
命令并且它也运行良好。我必须使用 ProjectName.deploy.cmd
,因为它是作为 Team Build
的 TFS2010
的一部分生成的。 最佳答案
你有没有试过引用这个论点?
ProjectName.deploy.cmd /Y "/M:https://WebServer01:8172/MSDeploy.axd?Site=MySiteName"
-AllowUntrusted /U:DeployUserName /P:Password /A:Basic
关于deployment - 如何在ProjectName.deploy.cmd中传递站点名称,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12721896/