尝试使用Web部署时拒绝访问

时间:2013-05-10 17:16:53

标签: tfs msbuild web-deployment tfs2012 webdeploy

我一直关注Standard Environments for Automated Deployment and Testing,但我遇到了一些错误。

我有两台服务器,一台 Windows Server 2008 R2 ,另一台 Windows Server 2012 。我已经安装Web Deploy 3并且两台计算机上都运行了服务Web Deployment Agent Service。我在我的域中有服务帐户,并且我将这两台计算机上的帐户添加到管理员组。我还将此帐户用于构建和测试控制器和代理。

2008服务器是构建服务器,我想将带有构建服务器的网站部署到2012服务器。我有一个构建定义,使用zip和deploy.cmd等使用标准的 TFS 2012 Update 2 进程模板(添加/p:DeployOnBuild=True作为MS构建参数)。< / p>

我有另一个基于LabDefaultTemplate TFS 2012更新2模板的构建定义。在实验室流程模板中,我在部署选项卡上添加了以下命令:

"$(BuildLocation)\_PublishedWebsites\UI.Web.Mvc4_Package\UI.Web.Mvc4.deploy.cmd" /y /m:SERVERNAME_OF_THE_2012_SERVER

当我运行第二个构建定义时,我收到“拒绝访问”错误。我不知道它来自哪里。我发现这里没有任何特别的事情发生。我还将日志设置为诊断,但这不起作用。

当我与远程桌面建立连接到2008构建服务器并手动运行相同的deploy.cmd时,一切正常。该站点部署在2012服务器上,一切都在运行。

有人可以帮助我吗?

由于

从构建中添加了日志:

Deploy Build on Environment

00:22
Deploying Build

00:22
Run Deployment scripts
Initial Property Values
Values = Web Server | $(BuildLocation)\_PublishedWebsites\UI.Web.Mvc4_Package\start.bat

00:22
Run Deployment Task
Initial Property Values
BuildLocation = \\AP-GDA06-TFSB\DropFolder\Dev MVC4\Dev MVC4_20130510.11
DeploymentScriptDetails = Web Server | $(BuildLocation)\_PublishedWebsites\UI.Web.Mvc4_Package\start.bat
LabEnvironmentUri = vstfs:///LabManagement/LabEnvironment/3
MaxWaitTime = 00:30:00
ThrowOnError = True
UseRoleForDeployment = True
Deployment Task Logs for Machine: 2012_SERVER
 Access is denied
 Exception Message: Team Foundation Server could not complete the deployment task for machine '2012_SERVER', script '\\2008_SERVER\DropFolder\Dev MVC4\Dev MVC4_20130510.11\_PublishedWebsites\UI.Web.Mvc4_Package\start.bat' and arguments ''. (type LabDeploymentProcessException)
Exception Stack Trace: 
Server stack trace: 
   at Microsoft.TeamFoundation.Lab.Workflow.Activities.RunDeploymentTask.ExecuteDeploymentTask.RunCommand(AsyncState state)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
   at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
   at System.Action`1.EndInvoke(IAsyncResult result)
   at Microsoft.TeamFoundation.Lab.Workflow.Activities.RunDeploymentTask.ExecuteDeploymentTask.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
   at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
Final Property Values
BuildLocation = \\2008_SERVER\DropFolder\Dev MVC4\Dev MVC4_20130510.11
DeploymentScriptDetails = Web Server | $(BuildLocation)\_PublishedWebsites\UI.Web.Mvc4_Package\start.bat
LabEnvironmentUri = vstfs:///LabManagement/LabEnvironment/3
MaxWaitTime = 00:30:00
ThrowOnError = True
UseRoleForDeployment = True
Final Property Values
Values = Web Server | $(BuildLocation)\_PublishedWebsites\UI.Web.Mvc4_Package\start.bat

启动的BAT文件包含以下命令:

START UI.Web.Mvc4.deploy.cmd /y /m:2012_SERVER

3 个答案:

答案 0 :(得分:1)

如果您启动使用 DefaultLabTemplate 的构建定义,您应该在构建日志中看到以下内容:

...

If deployment needed
 Do deployment
  Reserve Environment For Deployment
  Deploy Build on Environment
    Deploying Build
      Run Deployment scripts
        Run Deployment Task
          Deployment Task Logs for Machine: <your machine> 
            Accessing the following location using the lab service account: <your service account>, <your drop location>.

...

您是否看到实验室服务帐户正在使用?

答案 1 :(得分:0)

检查此答案:https://stackoverflow.com/a/16566204/648297

这是我的解决方案。

这对您也很有用:What is Lab Service Account?

答案 2 :(得分:0)

在单向信任或隔离/工作组网络配置上使用Visual Studio 2012 Update 4和Team Foundation Server,我们发现需要执行其他步骤。通过Build-Deploy-Test工作流程(但不是Web Deploy)运行自动化单元测试时,我们发现设置实验室服务帐户只是解决方案的一部分。为了避免构建中出现访问被拒绝错误,我们还必须为Visual Studio Lab Agent Service设置用户。

这是设置实验室服务帐户后服务小程序中的服务(在此示例中为“。\ LabAdmin”):

Visual Studio Lab Agent Service         | Configures, monitors... | Running | Automatic | Local System  
Visual Studio Lab Network Agent Service | Sets network propert... | Running | Automatic | Local System  
Visual Studio Test Agent                | Provides distributed... | Running | Automatic | .\LabAdmin  

为了修复Access拒绝错误,我们还必须在实验室服务帐户下运行Visual Studio Lab Agent服务:

Visual Studio Lab Agent Service         | Configures, monitors... | Running | Automatic | .\LabAdmin  
Visual Studio Lab Network Agent Service | Sets network propert... | Running | Automatic | Local System  
Visual Studio Test Agent                | Provides distributed... | Running | Automatic | .\LabAdmin  

进行此更改并重新启动服务后,Access被拒绝错误消失了。这在两台不同的目标计算机上重复进行,至少在我们的配置下,它似乎是必要的步骤。