我正在尝试运行由MSBuild生成的ProjectName.deploy.cmd文件,当参数/p:DeployOnBuild=True
被传递时。其中一个参数“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
。我已经阅读了在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
,因为它是由TFS2010
中的Team Build
生成的一部分。