为什么 Web Deploy 使用了错误的帐户?

Why is Web Deploy using the wrong account?

当我从本地计算机上的 Visual Studio 启动 Web 部署时,我已经验证它可以正常工作(使用 NTLM 授权)。现在我希望我的构建服务器每晚自动部署(如果合适的话)。我在构建服务器上使用 Jenkins,并且我已经在远程计算机上的 IIS 中授予帐户访问权限。我的 MSBuild 参数如下:

/p:DeployOnBuild=true  
/p:Configuration=Debug  
/p:Platform=x86  
/p:PublishProfile=DEV  
/p:AuthType=NTLM  
/p:AllowUntrustedCertificate=True  
/p:Username=

DEV 发布配置文件指定我的 DEV 服务器使用自签名证书,因此需要不受信任的证书。 NTLM 和空白用户名应使用当前 user/account 进行连接。

但是,Jenkins 作业的 MSBuild 步骤失败并出现此错误

msdeploy error ERROR_USER_UNAUTHORIZED: Web deployment task failed. (Connected to the remote computer ("DEV-SERVER") 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.)

当我查看 DEV-SERVER 上的 IIS 日志时,我看到以下内容:

2016-01-06 23:55:10 159.212.19.186 HEAD /msdeploy.axd site=MySite 8172 - 159.212.19.123 - 401 2 5 0
2016-01-06 23:55:10 159.212.19.186 HEAD /msdeploy.axd site=MySite 8172 CO\BUILD-SERVER$ 159.212.19.123 - 401 2 64 78

我期待看到 CO\jenkins,Jenkins 帐户在 运行 下,而不是 CO\BUILD-SERVER$。 (最后的 $ 是什么?)我认为使用了错误的帐户是否正确?我需要做什么才能让它正常工作?

CO\BUILD-SERVER$ 是您构建服务器的机器帐户。

如果你在那台机器上有一个从 运行ning,它是 运行ning 作为一个 windows 服务吗?如果是这样,它可能 运行ning 为 "System"

也重新进行 Selenium 测试,如果测试 运行 在构建服务器上进行,则服务可能需要以交互方式设置为 运行,以便测试可以 运行 针对UI.