11

使用 Visual Studio 2012、TFS 2010、IIS7

尝试构建/部署时出现以下错误:

Any CPU | Test
1 error(s), 1 warning(s)

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets      
(4253): Web deployment task failed. (Connected to the remote computer ("server1") 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.)

*snip warning*

Other Errors and Warnings
2 error(s), 0 warning(s)
Building the projects in this solution one at a time. To enable parallel build, please 
add the "/m" switch.
TF270015: 'MSBuild.exe' returned an unexpected exit code. Expected '0'; actual '1'.
  • 我验证了该站点存在于 IIS 中
  • 我确认我的用户名和密码正确(我可以登录服务器)
  • 用户是 tfs 服务器上的管理员

我的 tfs 服务器上没有 VS2012,但不久前有人将他们的 C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0 文件夹复制到 tfs 服务器以解决另一个构建问题。我将同一个文件夹复制到“server1”,没有更改错误消息。

它仍然创建构建,只是不部署。

4

5 回答 5

11

我们能够通过以下步骤解决该问题:

  • 在 IIS 管理器中突出显示网站
  • 在功能视图中,打开 IIS 管理器权限
  • 验证您部署的用户是否已添加。如果没有,请单击允许用户并添加它。

希望这可以帮助!

于 2015-03-12T20:49:09.263 回答
9

我的密码和下一个构建参数之间没有空格,所以密码在技术上是错误的。

/p:UserName=scw /p:Password=12345/p:VisualStudioVersion=11.0
/p:UserName=scw /p:Password=12345 /p:VisualStudioVersion=11.0
于 2014-05-13T19:22:02.787 回答
2

如果您指定了错误的站点名称,就会发生这种情况。您必须输入出现在 IIS 连接中的名称,例如Default Web Site.

在此处输入图像描述

于 2016-02-24T01:03:29.990 回答
1

我在一个环境中遇到了同样的问题,而在另一个环境中没有。我的问题是我没有在用户名前面加上计算机名(即 p:UserName=testserver\admin vs p:UserName=admin)。在我的工作环境中,两台服务器都通过 Active Directory 使用了一个帐户,所以这不是问题。学过的知识!

于 2017-09-27T20:36:47.227 回答
-5

我建议不要使用 Team Build 进行部署。我假设它正在为每个部署进行编译。这不是一个好主意,因为编译器不是 100%,因此构建之间的事情可能会发生变化。您最好使用部署工具进行二进制部署。我已经非常有效地使用 Visual Studio 2013 的发布管理从 Dev->QA->Prod 部署相同的二进制文件...

您可以从使用 Visual Studio 2013的专业应用程序生命周期管理中获取有关如何使用的信息。

于 2014-05-14T11:13:25.793 回答