TFS 构建 Visual Studio 测试代理部署任务的 PowerShell 远程处理错误 [英] PowerShell Remoting error with TFS build Visual Studio Test Agent Deployment task

查看:37
本文介绍了TFS 构建 Visual Studio 测试代理部署任务的 PowerShell 远程处理错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在致力于将自动化 UI 功能测试集成到非 XAML TFS 构建中.

I'm working on integration of automated UI functional tests into non-XAML TFS build.

我的构建定义指定了以下构建步骤:- 获取来源- NuGet 安装程序- MSBuild- Windows 机器文件复制- Visual Studio 测试代理部署- 运行功能测试

My build definition specifies the following build steps: - Get Sources - NuGet Installer - MSBuild - Windows Machine File Copy - Visual Studio Test Agent Deployment - Run Functional Tests

前四个步骤成功完成.第 4 步(Windows 机器文件复制)将我们的测试项目应用程序文件夹内容从我们的构建服务器复制到另一个远程 VM,托管我们的测试代理.目的是在构建服务器上完成构建(如当前设置),然后将测试项目复制到测试代理服务器,部署测试代理并在测试 VM 上运行功能测试.

The first four steps complete successfully. Step 4 (Windows Machine File Copy) copies our test project application folder contents from our build server to another remote VM, hosting our Test Agent. The intention is to complete the build (as currently set up) on the build server, then copy the test project to the test agent server, deploy the test agent and run the functional tests on the test VM.

我在第 5 步(Visual Studio 测试代理部署)中遇到了问题;返回以下错误:

I ran into issues with step 5 (Visual Studio Test Agent Deployment); the following error was returned:

[server_name]:5986"发生错误.详细信息:连接到远程服务器 [server_name] 失败并显示以下错误消息:客户端无法连接到请求中指定的目标.验证目标上的服务是否正在运行并且正在接受请求.查阅在目标上运行的 WS-Management 服务的日志和文档,最常见的是 IIS 或 WinRM.如果目标是 WinRM 服务,则在目标上运行以下命令来分析和配置 WinRM 服务:winrm quickconfig".有关详细信息,请参阅 about_Remote_Troubleshooting 帮助主题.'.有关故障排除,请参阅 https://aka.ms/remotevstest.

Error occurred on ''[server_name]:5986'. Details : 'Connecting to remote server [server_name] failed with the following error message : The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig". For more information, see the about_Remote_Troubleshooting Help topic.'. For troubleshooting, refer https://aka.ms/remotevstest.

我对这个错误的研究表明问题与 PowerShell Remoting 相关,而不是与 TFS 构建相关(TFS 构建任务包装了要在远程 VM 上执行的 PowerShell 命令).

My research into this error indicates that the problem is associated with PowerShell Remoting, rather than the TFS build (the TFS build task wraps a PowerShell command to be executed on the remote VM).

我已经根据错误消息建议检查并仔细检查了目标(测试代理)服务器上的 WinRM 服务;WinRM 服务已打开并配置为接受请求.我还根据建议运行了winrm quickconfig"命令.问题仍然存在.

I have checked and double-checked that the WinRM service on the target (test agent) server as per error message suggestion; the WinRM service is on and is configured to accept requests. I have also run the "winrm quickconfig" command as per suggestion. Still the issue persists.

我们的服务器在同一个域中.我拥有测试代理(远程)VM 的管理权限,但无法访问构建(本地)VM.

Our servers are on the same domain. I have administrative privileges on the test agent (remote) VM but no access to the build (local) VM.

我一直在为这个问题苦苦挣扎一段时间;我非常感谢任何可能有助于解决问题的见解.

I've been struggling with this issue for some time now; I'd very much appreciate any insights that may help to resolve.

感谢您的关注.

更新:

嗨安迪,感谢您的关注 &回答.

Hi Andy, thanks for looking & answering.

我按照您的建议执行了以下步骤:

I followed the steps as per your suggestions:

按照您提供的链接,Windows 8.1 和 Windows Server 2012 R2,我发现重要此更新已被更新 2919355 取代".检查我的测试代理框后,已安装更新 2919355.

Following the link you provided, Windows 8.1 and Windows Server 2012 R2, I found that "Important This update has been superseded by update 2919355 ." Having checked my test agent box, update 2919355 has been installed.

'Enter-PSSession localhost' cmdlet 返回错误:连接到远程服务器 localhost 失败,并显示以下错误消息:WinRM 客户端向 HTTP 服务器发送了一个请求,并得到了一个响应,指出请求的 HTTP URL 不可用.这通常是由不支持 WS 的 HTTP 服务器返回的-管理协议..."

The 'Enter-PSSession localhost' cmdlet returned the error: "Connecting to remote server localhost failed with the following error message : The WinRM client sent a request to an HTTP server and got a response saying the requested HTTP URL was not available. This is usually returned by a HTTP server that does not support the WS-Management protocol..."

然后我根据建议执行了启用-PSRemoting"并确认是"以执行每个操作.此后,再次执行Enter-PSSession localhost"返回与之前相同的错误.

I then executed 'Enable-PSRemoting' as per suggestion and confirmed 'Yes' to perform each action. After this, another execution of 'Enter-PSSession localhost' returned the same error as before.

最后,我再次尝试了'Enable-PSRemoting -Force';这返回:WinRM 已设置为在此计算机上接收请求.WinRM 已设置为在此计算机上进行远程管理."

Finally, I once again tried 'Enable-PSRemoting -Force'; this returned: "WinRM is already set up to receive requests on this computer. WinRM is already set up for remote management on this computer."

进一步尝试在服务器上远程执行 PS1 脚本返回原始错误.

Further attempts to remotely execute the PS1 script on the server return the original error.

我的测试代理服务器运行的是 Windows Server 2012 R2,我使用的是 PowerShell 4.0 版.

My test agent server is running Windows Server 2012 R2, I am using PowerShell version 4.0.

推荐答案

好的,正如我之前在对原始帖子的更新中所指出的,我已经(反复)用完了 Andy 和其他地方提供的上述建议.

Okay, as I indicated earlier in my update to the original post, I had exhausted (repeatedly) the recommendations provided above by Andy and elsewhere.

即使Enable-PSRemoting -Force"cmdlet 的执行已返回WinRM 已设置为在此计算机上接收请求.WinRM 已设置为在此计算机上进行远程管理.",在测试代理中服务器的管理控制台,(在Local Computer Policy\Computer Configuration\Administrative Templates\Windows Components\Windows Remote Management (WinRM)\WinRM Service\下),设置'Allow remote server management through WinRM' 被标记为 '未配置'.

Even though the execution of the 'Enable-PSRemoting -Force' cmdlet has returned "WinRM is already set up to receive requests on this computer. WinRM is already set up for remote management on this computer.", in the test agent server's management console, (under Local Computer Policy\Computer Configuration\Administrative Templates\Windows Components\Windows Remote Management (WinRM)\WinRM Service\), the setting 'Allow remote server management through WinRM' was marked 'Not configured'.

我将此更新为已启用".

然后我在 Windows 防火墙中创建了一个新的入站规则(在上面更新 WinRM 服务配置时提示),配置为允许安全连接,通过默认 TCP 端口 5985 添加我指定的构建服务器.

I then created a new inbound rule in the Windows Firewall (prompted when updating WinRM service config above), configuring to allow secure connections, adding my specified build server, via the default TCP port 5985.

这解决了问题.

这篇关于TFS 构建 Visual Studio 测试代理部署任务的 PowerShell 远程处理错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆