我正在尝试将一些VS测试设置为在Windows服务器计算机上远程运行。它会将所需的工件下载到目标计算机,但在尝试部署测试代理时,它会因以下不明确的错误而失败:
The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Exception calling ".ctor" with "2" argument(s): "One or more errors occurred."'. For troubleshooting, refer https://aka.ms/remotevstest.
我查看了ps脚本runnning,即TestAgentConfiguration.ps1,看起来它在尝试运行此行时失败
$DtaAgentClient = New-Object Microsoft.VisualStudio.TestService.Utility.TestExecutionServiceRestApiHelper -ArgumentList $TfsCollection, $PersonalAccessToken
但是,我确实可以从目标机器访问TFS服务器......任何想法?
以下是整个日志:
2017-12-12T13:38:04.7959295Z ##[section]Starting: Deploy TestAgent on
2017-12-12T13:38:04.8099296Z ==============================================================================
2017-12-12T13:38:04.8099296Z Task : Visual Studio Test Agent Deployment
2017-12-12T13:38:04.8109296Z Description : Deploy and configure Test Agent to run tests on a set of machines
2017-12-12T13:38:04.8109296Z Version : 2.1.8
2017-12-12T13:38:04.8109296Z Author : Microsoft Corporation
2017-12-12T13:38:04.8109296Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkId=838890)
2017-12-12T13:38:04.8109296Z ==============================================================================
2017-12-12T13:38:08.9079295Z ****************************************************************
2017-12-12T13:38:08.9079295Z Task Input Information
2017-12-12T13:38:08.9079295Z ----------------------------------------------------------------
2017-12-12T13:38:08.9079295Z testMachineInput = x
2017-12-12T13:38:08.9079295Z adminUserName = x
2017-12-12T13:38:08.9079295Z winRmProtocal = Http
2017-12-12T13:38:08.9079295Z testCertificate = true
2017-12-12T13:38:08.9079295Z machineUserName = x
2017-12-12T13:38:08.9079295Z runAsProcess = false
2017-12-12T13:38:08.9079295Z logonAutomatically = false
2017-12-12T13:38:08.9079295Z disableScreenSaver = false
2017-12-12T13:38:08.9079295Z isDataCollectionOnly = false
2017-12-12T13:38:08.9079295Z testPlatform = 15.0
2017-12-12T13:38:08.9079295Z agentLocation =
2017-12-12T13:38:08.9079295Z updateTestAgent = false
2017-12-12T13:38:08.9079295Z ****************************************************************
2017-12-12T13:38:09.8859300Z Starting to deploy and configure test agent on test machines.
2017-12-12T13:38:09.8869298Z Inputs provided are:
2017-12-12T13:38:09.8869298Z Use HTTP Port: True
2017-12-12T13:38:09.8869298Z Username: x
2017-12-12T13:38:09.8869298Z Disable Screen saver: False
2017-12-12T13:38:09.8869298Z Login Automatically: False
2017-12-12T13:38:09.8869298Z Run as process: False
2017-12-12T13:38:09.8869298Z Agent would be downloaded from https://go.microsoft.com/fwlink/?LinkId=615472
2017-12-12T13:38:09.8869298Z Update test agent: False
2017-12-12T13:38:09.8869298Z Run test agent as DataCollection only : False
2017-12-12T13:38:10.3119286Z Task 'VerifyTestAgentInstalled' on machine 'x:5985' is being run
2017-12-12T13:38:15.1009298Z Task 'VerifyTestAgentInstalled' on machine 'x:5985' completed.
2017-12-12T13:38:15.1099303Z Deployment started on target machine...
2017-12-12T13:38:15.1099303Z
2017-12-12T13:38:15.1099303Z Query for Testplatfrom version: 15.0
2017-12-12T13:38:15.1099303Z
2017-12-12T13:38:15.1099303Z Testing container: 'REGISTRY::HKEY_CLASSES_ROOT\CLSID\{177F0C4A-1CD3-4DE7-A32C-71DBBB9FA36D}'
2017-12-12T13:38:15.1099303Z
2017-12-12T13:38:15.1099303Z Does not exist.
2017-12-12T13:38:15.1109292Z
2017-12-12T13:38:15.1109292Z Test Agent does not exists
2017-12-12T13:38:15.1109292Z
2017-12-12T13:38:15.1109292Z
2017-12-12T13:38:15.1109292Z RemoteDeployerSource Verbose: 2 : [RemoteDeployer][12:dec:17:14:38:11:8551; 1540, 4](NPSIIS2012R2-01)Created public key for communication
2017-12-12T13:38:15.1109292Z RemoteDeployerSource Information: 12 : [RemoteDeployer][12:dec:17:14:38:11:8551; 1540, 4](NPSIIS2012R2-01)Deployment service - VisualStudioRemoteDeployer6df0f6fb-f194-4fb7-97fa-d74cb1d363aa is running...
2017-12-12T13:38:15.1109292Z RemoteDeployerSource Verbose: 4 : [RemoteDeployer][12:dec:17:14:38:12:8862; 1540, 5](NPSIIS2012R2-01)Input file found
2017-12-12T13:38:15.1109292Z RemoteDeployerSource Verbose: 5 : [RemoteDeployer][12:dec:17:14:38:12:8862; 1540, 5](NPSIIS2012R2-01)Reading input parameters
2017-12-12T13:38:15.1109292Z RemoteDeployerSource Verbose: 6 : [RemoteDeployer][12:dec:17:14:38:12:8862; 1540, 5](NPSIIS2012R2-01)Finished reading input parameters
2017-12-12T13:38:15.1109292Z
2017-12-12T13:38:17.3459301Z Starting to download testagent
2017-12-12T13:38:17.3499295Z testagent is downloaded at: C:\TestAgent\58435510-14c6-40f3-ab6b-61fb7d45d0ed
2017-12-12T13:38:17.3499295Z Task 'CopyFilesToTestAgent' on machine 'x:5985' is being run
2017-12-12T13:38:17.3499295Z Task 'CopyFilesToTestAgent' on machine 'x:5985' completed.
2017-12-12T13:38:17.3499295Z
2017-12-12T13:38:17.3499295Z \\x was deleted successfully.
2017-12-12T13:38:17.3499295Z
2017-12-12T13:38:17.3509293Z Copying recursively from C:\TestAgent\58435510-14c6-40f3-ab6b-61fb7d45d0ed to C:\TestAgent on machine x succeeded.
2017-12-12T13:38:17.3509293Z
2017-12-12T13:38:17.3509293Z \\x was deleted successfully.
2017-12-12T13:38:17.3509293Z
2017-12-12T13:38:17.3509293Z
2017-12-12T13:39:17.1479291Z Task 'InstallTestAgent' on machine 'x:5985' is being run
2017-12-12T13:40:17.1549303Z Task 'InstallTestAgent' on machine 'x:5985' is taking time. Please Wait
2017-12-12T13:41:14.2969287Z Deployment started on target machine...
2017-12-12T13:41:14.2969287Z
2017-12-12T13:41:14.2969287Z Setup path: C:\TestAgent\vstf_testagent.exe
2017-12-12T13:41:14.2969287Z
2017-12-12T13:41:14.2969287Z Testing container: 'REGISTRY::HKEY_CLASSES_ROOT\CLSID\{177F0C4A-1CD3-4DE7-A32C-71DBBB9FA36D}'
2017-12-12T13:41:14.2969287Z
2017-12-12T13:41:14.2969287Z Does not exist.
2017-12-12T13:41:14.2969287Z
2017-12-12T13:41:14.2969287Z Installed Test Agent version: 0.0
2017-12-12T13:41:14.2969287Z
2017-12-12T13:41:14.2969287Z Requested Test Agent version: 15.5.27130
2017-12-12T13:41:14.2969287Z
2017-12-12T13:41:14.2969287Z Test Agent will be installed
2017-12-12T13:41:14.2969287Z
2017-12-12T13:41:14.2969287Z No test agent certificate found.
2017-12-12T13:41:14.2969287Z
2017-12-12T13:41:14.2969287Z Exit code from installation 0
2017-12-12T13:41:14.2969287Z
2017-12-12T13:41:14.2969287Z
2017-12-12T13:41:14.2969287Z RemoteDeployerSource Verbose: 2 : [RemoteDeployer][12:dec:17:14:39:17:8071; 2820, 4](x)Created public key for communication
2017-12-12T13:41:14.2969287Z RemoteDeployerSource Information: 12 : [RemoteDeployer][12:dec:17:14:39:17:8071; 2820, 4](x)Deployment service - VisualStudioRemoteDeployer38030956-3f0b-4c95-8984-02555aeeb5cf is running...
2017-12-12T13:41:14.2969287Z RemoteDeployerSource Verbose: 4 : [RemoteDeployer][12:dec:17:14:39:18:8259; 2820, 5](x)Input file found
2017-12-12T13:41:14.2969287Z RemoteDeployerSource Verbose: 5 : [RemoteDeployer][12:dec:17:14:39:18:8259; 2820, 5](x)Reading input parameters
2017-12-12T13:41:14.2969287Z RemoteDeployerSource Verbose: 6 : [RemoteDeployer][12:dec:17:14:39:18:8259; 2820, 5](x)Finished reading input parameters
2017-12-12T13:41:14.2969287Z
2017-12-12T13:41:14.2979294Z Task 'InstallTestAgent' on machine 'x:5985' completed.
2017-12-12T13:41:14.5299296Z Task 'CopyFilesToTestAgent' on machine 'x:5985' is being run
2017-12-12T13:41:14.9079281Z
2017-12-12T13:41:14.9079281Z \\x was deleted successfully.
2017-12-12T13:41:14.9079281Z
2017-12-12T13:41:14.9079281Z Copying recursively from C:\Builds2015\agent2\_work\_tasks\DeployVisualStudioTestAgent_52a38a6a-1517-41d7-96cc-73ee0c60d2b6\2.1.8\TestExecution.zip to C:\TestAgent on machine x succeeded.
2017-12-12T13:41:14.9079281Z
2017-12-12T13:41:14.9089280Z \\x was deleted successfully.
2017-12-12T13:41:14.9089280Z
2017-12-12T13:41:14.9089280Z
2017-12-12T13:41:14.9089280Z Task 'CopyFilesToTestAgent' on machine 'x:5985' completed.
2017-12-12T13:41:14.9323708Z Task 'TestAgentConfiguration' on machine 'x:5985' is being run
2017-12-12T13:42:10.9609296Z RemoteDeployerSource Verbose: 2 : [RemoteDeployer][12:dec:17:14:41:15:5500; 3360, 4](x)Created public key for communication
2017-12-12T13:42:10.9609296Z RemoteDeployerSource Information: 12 : [RemoteDeployer][12:dec:17:14:41:15:5500; 3360, 4](x)Deployment service - VisualStudioRemoteDeployerd005bda2-0ecf-4c84-9457-612a290bec8a is running...
2017-12-12T13:42:10.9609296Z RemoteDeployerSource Verbose: 4 : [RemoteDeployer][12:dec:17:14:41:16:5705; 3360, 5](x)Input file found
2017-12-12T13:42:10.9609296Z RemoteDeployerSource Verbose: 5 : [RemoteDeployer][12:dec:17:14:41:16:5705; 3360, 5](x)Reading input parameters
2017-12-12T13:42:10.9609296Z RemoteDeployerSource Verbose: 6 : [RemoteDeployer][12:dec:17:14:41:16:5705; 3360, 5](x)Finished reading input parameters
2017-12-12T13:42:10.9609296Z
2017-12-12T13:42:10.9609296Z Task 'TestAgentConfiguration' on machine 'x:5985' completed.
2017-12-12T13:42:10.9609296Z ##[warning]Task 'TestAgentConfiguration' for machine x:5985's Error : System.Exception: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Exception calling ".ctor" with "2" argument(s): "One or more errors occurred."
2017-12-12T13:42:10.9619289Z ##[warning]Task 'TestAgentConfiguration' for machine x:5985's Log :
2017-12-12T13:42:10.9619289Z Deployment started on target machine...
2017-12-12T13:42:10.9619289Z
2017-12-12T13:42:10.9619289Z System.AggregateException: Failed to execute the powershell script. Consult the logs below for details of the error.
2017-12-12T13:42:10.9619289Z The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Exception calling ".ctor" with "2" argument(s): "One or more errors occurred." ---> System.Management.Automation.ActionPreferenceStopException: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Exception calling ".ctor" with "2" argument(s): "One or more errors occurred."
2017-12-12T13:42:10.9619289Z at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
2017-12-12T13:42:10.9619289Z at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
2017-12-12T13:42:10.9619289Z at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
2017-12-12T13:42:10.9619289Z at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
2017-12-12T13:42:10.9619289Z at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
2017-12-12T13:42:10.9619289Z at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)
2017-12-12T13:42:10.9619289Z at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Deployment.PowershellExecutor.<>c__DisplayClass28_0.<Invoke>b__0()
2017-12-12T13:42:10.9619289Z at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Utilities.RetryExecutor.<>c__DisplayClass19_0`1.<Execute>b__0()
2017-12-12T13:42:10.9619289Z at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Utilities.RetryExecutor.Execute(Action action)
2017-12-12T13:42:10.9619289Z at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Utilities.RetryExecutor.Execute[T](Func`1 action)
2017-12-12T13:42:10.9629284Z at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Deployment.PowershellExecutor.Invoke(String errorContextMessage, Boolean writeResultToLog, Boolean isCancellable, ActionPreference errorActionPreference)
2017-12-12T13:42:10.9629284Z --- End of inner exception stack trace ---
2017-12-12T13:42:10.9629284Z at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Deployment.PowershellExecutor.Invoke(String errorContextMessage, Boolean writeResultToLog, Boolean isCancellable, ActionPreference errorActionPreference)
2017-12-12T13:42:10.9629284Z at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Deployment.ScriptExecutor.ExecuteScript(IPowerShell powerShell, String script, String arguments, Boolean isScriptDotSourced, Boolean useHttp)
2017-12-12T13:42:10.9629284Z at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Deployment.DeploymentService.RunPowerShellScripts(DeploymentMachineSpecification deploymentMachine, ScriptSpecification scriptSpecification, ScriptSpecification initializationScriptSpecification, String applicationPath, IPowerShell powerShellSession)
2017-12-12T13:42:10.9639291Z ---> (Inner Exception #0) System.Management.Automation.ActionPreferenceStopException: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Exception calling ".ctor" with "2" argument(s): "One or more errors occurred."
2017-12-12T13:42:10.9639291Z at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
2017-12-12T13:42:10.9639291Z at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
2017-12-12T13:42:10.9639291Z at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
2017-12-12T13:42:10.9639291Z at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
2017-12-12T13:42:10.9649298Z at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
2017-12-12T13:42:10.9649298Z at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)
2017-12-12T13:42:10.9649298Z at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Deployment.PowershellExecutor.<>c__DisplayClass28_0.<Invoke>b__0()
2017-12-12T13:42:10.9649298Z at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Utilities.RetryExecutor.<>c__DisplayClass19_0`1.<Execute>b__0()
2017-12-12T13:42:10.9649298Z at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Utilities.RetryExecutor.Execute(Action action)
2017-12-12T13:42:10.9649298Z at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Utilities.RetryExecutor.Execute[T](Func`1 action)
2017-12-12T13:42:10.9649298Z at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Deployment.PowershellExecutor.Invoke(String errorContextMessage, Boolean writeResultToLog, Boolean isCancellable, ActionPreference errorActionPreference)<---
2017-12-12T13:42:10.9649298Z Testing container: 'REGISTRY::HKEY_CLASSES_ROOT\CLSID\{177F0C4A-1CD3-4DE7-A32C-71DBBB9FA36D}'
2017-12-12T13:42:10.9649298Z
2017-12-12T13:42:10.9649298Z Exists.
2017-12-12T13:42:10.9649298Z
2017-12-12T13:42:10.9649298Z Getting Visual Studio setup instances.
2017-12-12T13:42:10.9649298Z
2017-12-12T13:42:10.9649298Z Found 1 instances.
2017-12-12T13:42:10.9649298Z
2017-12-12T13:42:10.9649298Z
2017-12-12T13:42:10.9649298Z
2017-12-12T13:42:10.9649298Z Description : Supports running automated tests and load tests remotely
2017-12-12T13:42:10.9649298Z DisplayName : Visual Studio Test Agent 2017
2017-12-12T13:42:10.9649298Z Id : 48324a16
2017-12-12T13:42:10.9659298Z InstallDate : System.Runtime.InteropServices.ComTypes.FILETIME
2017-12-12T13:42:10.9659298Z Name : VisualStudio/15.5.1+27130.2003
2017-12-12T13:42:10.9659298Z Path : C:\TestAgent2017
2017-12-12T13:42:10.9659298Z Version : 15.5.27130.2003
2017-12-12T13:42:10.9659298Z VersionString : 15.5.27130.2003
2017-12-12T13:42:10.9659298Z
2017-12-12T13:42:10.9659298Z
2017-12-12T13:42:10.9659298Z
2017-12-12T13:42:10.9659298Z
2017-12-12T13:42:10.9659298Z
2017-12-12T13:42:10.9659298Z VS path C:\TestAgent2017\Common7\IDE; Test window path C:\TestAgent2017\Common7\IDE\CommonExtensions\Microsoft\TestWindow
2017-12-12T13:42:10.9659298Z
2017-12-12T13:42:10.9659298Z Path: C:\TestAgent\TfsAssemblies\Newtonsoft.Json.dll
2017-12-12T13:42:10.9659298Z
2017-12-12T13:42:10.9659298Z Loading module from path 'C:\TestAgent\TfsAssemblies\Newtonsoft.Json.dll'.
2017-12-12T13:42:10.9659298Z
2017-12-12T13:42:10.9659298Z Loading module from path 'C:\TestAgent\TfsAssemblies\System.Net.Http.Formatting.dll'.
2017-12-12T13:42:10.9659298Z
2017-12-12T13:42:10.9659298Z Loading module from path 'C:\TestAgent\TfsAssemblies\Microsoft.TeamFoundation.DistributedTask.Task.TestExecution.dll'.
2017-12-12T13:42:10.9659298Z
2017-12-12T13:42:10.9659298Z Loading module from path 'C:\TestAgent\TfsAssemblies\Microsoft.TeamFoundation.Common.dll'.
2017-12-12T13:42:10.9659298Z
2017-12-12T13:42:10.9669287Z Loading module from path 'C:\TestAgent\TfsAssemblies\Microsoft.TeamFoundation.Test.WebApi.dll'.
2017-12-12T13:42:10.9669287Z
2017-12-12T13:42:10.9669287Z Loading module from path 'C:\TestAgent\TfsAssemblies\Microsoft.VisualStudio.Services.Common.dll'.
2017-12-12T13:42:10.9669287Z
2017-12-12T13:42:10.9669287Z Loading module from path 'C:\TestAgent\TfsAssemblies\Microsoft.VisualStudio.Services.WebApi.dll'.
2017-12-12T13:42:10.9669287Z
2017-12-12T13:42:10.9669287Z Loading module from path 'C:\TestAgent\PrivateAssemblies\MS.VS.TestService.Client.Utility.dll'.
2017-12-12T13:42:10.9669287Z
2017-12-12T13:42:10.9669287Z ****************************************************************
2017-12-12T13:42:10.9669287Z
2017-12-12T13:42:10.9669287Z Configure Test Agent
2017-12-12T13:42:10.9669287Z
2017-12-12T13:42:10.9669287Z ----------------------------------------------------------------
2017-12-12T13:42:10.9669287Z
2017-12-12T13:42:10.9669287Z SetupPath : (C:\TestAgent)
2017-12-12T13:42:10.9669287Z
2017-12-12T13:42:10.9669287Z TestUserName : (x)
2017-12-12T13:42:10.9669287Z
2017-12-12T13:42:10.9669287Z TfsCollection : (x)
2017-12-12T13:42:10.9679288Z
2017-12-12T13:42:10.9679288Z AsServiceOrProcess : (Service)
2017-12-12T13:42:10.9679288Z
2017-12-12T13:42:10.9679288Z EnvironmentUrl : (x)
2017-12-12T13:42:10.9679288Z
2017-12-12T13:42:10.9679288Z MachineName : (x)
2017-12-12T13:42:10.9679288Z
2017-12-12T13:42:10.9679288Z Capabilities : ()
2017-12-12T13:42:10.9679288Z
2017-12-12T13:42:10.9679288Z TestAgentVersion : (15.0)
2017-12-12T13:42:10.9679288Z
2017-12-12T13:42:10.9679288Z ****************************************************************
2017-12-12T13:42:10.9679288Z
2017-12-12T13:42:10.9679288Z
2017-12-12T13:42:10.9679288Z ##[error]Error occured on 'x:5985'. Details : 'The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Exception calling ".ctor" with "2" argument(s): "One or more errors occurred."'. For troubleshooting, refer https://aka.ms/remotevstest.
2017-12-12T13:42:11.0919296Z ##[section]Finishing: Deploy TestAgent on
答案 0 :(得分:0)
更新
您正在使用的当前版本 Visual Studio测试代理部署(v2)
由于Test Agent 2017仅支持TAD v2,因此您必须更新TFS服务器版本,例如TFS2017update3。否则,您需要回滚到TAD v1并使用Test Agent 2015.
在这个类似的问题中,请看一下 prawalagarwal的评论:Run tests tasks failing after Deploy Agent task
除了请注意,Visual Studio Test Agent Deployment任务要求目标计算机具有: