【问题标题】:msdeploy 401 unauthorized error while msbuild works with same credentialsmsdeploy 401 未经授权的错误,而 msbuild 使用相同的凭据
【发布时间】:2017-06-06 16:54:36
【问题描述】:

我正在尝试部署一个网站,最初我有以下命令行

MSBuild.exe PortalWeb.sln
    /t:Rebuild
    /p:DeployOnBuild=True
    /p:DeployTarget=MsDeployPublish
    /p:MSDeployServiceURL=https://wwwt.mycompany.ru:8172/msdeploy.axd
    /p:DeployIISAppPath="Portal/test"
    /p:CreatePackageOnPublish=False
    /p:MsDeployPublishMethod=WMSVC
    /p:AllowUntrustedCertificate=True
    /p:UserName=DeployUser
    /p:Password=123pwd123
    /p:Configuration="Testing Env"

现在我正在使用 TFS 构建服务器并尝试使用生成以下命令的 Web 步骤

"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe"
    -verb:sync
    -source:package='PortalWeb.zip'
    -dest:auto,computerName='https://wwwt.mycompany.ru:8172/msdeploy.axd?site=Portal/test',userName='DeployUser',password='123pwd123',authType='WMSVC',includeAcls='False'
    -allowUntrusted 

此命令失败并出现 401 Unathorized 错误:

2017-06-06T16:00:12.7928227Z ##[error]System.Management.Automation.RemoteException: Error Code: ERROR_USER_UNAUTHORIZED

2017-06-06T16:00:12.7928227Z ##[error]System.Management.Automation.RemoteException: More Information: Connected to the remote computer ("wwwt.mycompany.ru") 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 creden

2017-06-06T16:00:12.7928227Z ##[error]System.Management.Automation.RemoteException: tials represent a user who has permissions to access the site.  Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_UNAUTHORIZED.

2017-06-06T16:00:12.7928227Z Error: The remote server returned an error: (401) Unauthorized.

2017-06-06T16:00:12.7928227Z Error count: 1.

为什么一个命令使用这些凭据而另一个失败?

【问题讨论】:

    标签: authentication msbuild continuous-integration msdeploy


    【解决方案1】:

    确保代理的服务帐号具有部署网站所需的权限。

    但更好的方法是在构建过程中创建一个工件包。这意味着构建您的包并将其发布到放置文件夹或 tfs 内。

    之后,您可以使用发布管理部署您的网站。如果你这样做,会有很多好处。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-25
      • 1970-01-01
      • 2015-10-14
      • 1970-01-01
      相关资源
      最近更新 更多