TFS 构建的 PowerShell 远程处理错误 Visual Studio 测试代理部署任务
PowerShell Remoting error with TFS build Visual Studio Test Agent Deployment task
我正在致力于将自动化 UI 功能测试集成到非 XAML TFS 构建中。
我的构建定义指定了以下构建步骤:
- 获取资源
- NuGet 安装程序
-MSBuild
- Windows 机器文件复制
- Visual Studio 测试代理部署
- 运行 功能测试
前四个步骤成功完成。第 4 步(Windows 机器文件复制)将我们的测试项目应用程序文件夹内容从我们的构建服务器复制到另一个远程 VM,托管我们的测试代理。目的是在构建服务器上完成构建(如当前设置),然后将测试项目复制到测试代理服务器,部署测试代理和 运行 测试 VM 上的功能测试。
我 运行 遇到第 5 步的问题(Visual Studio 测试代理部署);以下错误是 returned:
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 命令)。
我已经根据错误消息建议检查并仔细检查了目标(测试代理)服务器上的 WinRM 服务; WinRM 服务已打开并配置为接受请求。根据建议,我还有 运行 "winrm quickconfig" 命令。问题仍然存在。
我们的服务器在同一个域中。我对测试代理(远程)VM 具有管理权限,但无法访问构建(本地)VM。
我已经为这个问题苦苦挣扎了一段时间;我非常感谢任何可能有助于解决问题的见解。
感谢观看。
更新:
嗨,安迪,感谢您的浏览和回答。
我按照您的建议进行了操作:
根据您提供的 link,Windows 8.1 和 Windows Server 2012 R2,我发现 "Important This update has been superseded by update 2919355 ." 检查了我的测试代理框,更新 2919355 已经已安装。
'Enter-PSSession localhost' cmdlet return编辑了错误:
"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..."
然后我按照建议执行了'Enable-PSRemoting'并确认'Yes'执行了每一个动作。在此之后,再次执行 'Enter-PSSession localhost' returned 与之前相同的错误。
终于,我再次尝试了'Enable-PSRemoting -Force';这个 returned:
“WinRM 已设置为在此计算机上接收请求。
已在此计算机上设置 WinRM 以进行远程管理。"
进一步尝试在服务器上远程执行PS1脚本return原来的错误。
我的测试代理服务器是运行ning Windows Server 2012 R2,我使用的是PowerShell 4.0.
根据错误消息,这是由于 WinRM 配置中的问题。
确保您已在 构建代理 和 目标计算机 、运行 命令上启用 PSRemoting Enable-PSRemoting -Force
.
请尝试以下操作来缩小问题范围:
- 这可能与 Windows 8.1 的 package KB2883200 和
Windows 服务器 2012 R2。所以,在这种情况下,你可以检查你是否
已经安装了补丁
KB2883200
,如果不是就下载和
安装它,然后再试一次(您可能需要在
之后重新启动 VM
安装 KB)。
检查您是否在 Test Agent VM 上启用了 PSRemoting
:
远程到 VM,运行 PowerShell 管理员,运行 命令:
Enter-PSSession localhost
如果失败,则需要通过下面的 运行ning 启用 PSRemoting
命令:
Enable-PSRemoting
如果这不起作用或者它说它已经设置好了,那么试试
运行 以下命令:
Enable-PSRemoting -Force
此外,您可以参考以下文章手动配置WinRM服务:
好的,正如我之前在对原始 post 的更新中指出的那样,我已经(反复)用尽了 Andy 和其他地方提供的上述建议。
即使 'Enable-PSRemoting -Force' cmdlet 的执行已返回 "WinRM is already set up to receive requests on this computer. WinRM is already set up for remote management on this computer.",在测试代理服务器的管理控制台中(在 Local Computer Policy\Computer Configuration\Administrative Templates\Windows Components\Windows Remote Management (WinRM)\WinRM Service\
下),设置 'Allow remote server management through WinRM
' 被标记为 'Not configured
'。
我将其更新为“已启用”。
然后我在 Windows 防火墙中创建了一个新的入站规则(在上面更新 WinRM 服务配置时提示),配置为允许安全连接,通过默认的 TCP 端口 5985 添加我指定的构建服务器。
这解决了问题。
我正在致力于将自动化 UI 功能测试集成到非 XAML TFS 构建中。
我的构建定义指定了以下构建步骤: - 获取资源 - NuGet 安装程序 -MSBuild - Windows 机器文件复制 - Visual Studio 测试代理部署 - 运行 功能测试
前四个步骤成功完成。第 4 步(Windows 机器文件复制)将我们的测试项目应用程序文件夹内容从我们的构建服务器复制到另一个远程 VM,托管我们的测试代理。目的是在构建服务器上完成构建(如当前设置),然后将测试项目复制到测试代理服务器,部署测试代理和 运行 测试 VM 上的功能测试。
我 运行 遇到第 5 步的问题(Visual Studio 测试代理部署);以下错误是 returned:
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 命令)。
我已经根据错误消息建议检查并仔细检查了目标(测试代理)服务器上的 WinRM 服务; WinRM 服务已打开并配置为接受请求。根据建议,我还有 运行 "winrm quickconfig" 命令。问题仍然存在。
我们的服务器在同一个域中。我对测试代理(远程)VM 具有管理权限,但无法访问构建(本地)VM。
我已经为这个问题苦苦挣扎了一段时间;我非常感谢任何可能有助于解决问题的见解。
感谢观看。
更新:
嗨,安迪,感谢您的浏览和回答。
我按照您的建议进行了操作:
根据您提供的 link,Windows 8.1 和 Windows Server 2012 R2,我发现 "Important This update has been superseded by update 2919355 ." 检查了我的测试代理框,更新 2919355 已经已安装。
'Enter-PSSession localhost' cmdlet return编辑了错误: "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..."
然后我按照建议执行了'Enable-PSRemoting'并确认'Yes'执行了每一个动作。在此之后,再次执行 'Enter-PSSession localhost' returned 与之前相同的错误。
终于,我再次尝试了'Enable-PSRemoting -Force';这个 returned: “WinRM 已设置为在此计算机上接收请求。 已在此计算机上设置 WinRM 以进行远程管理。"
进一步尝试在服务器上远程执行PS1脚本return原来的错误。
我的测试代理服务器是运行ning Windows Server 2012 R2,我使用的是PowerShell 4.0.
根据错误消息,这是由于 WinRM 配置中的问题。
确保您已在 构建代理 和 目标计算机 、运行 命令上启用 PSRemoting Enable-PSRemoting -Force
.
请尝试以下操作来缩小问题范围:
- 这可能与 Windows 8.1 的 package KB2883200 和
Windows 服务器 2012 R2。所以,在这种情况下,你可以检查你是否
已经安装了补丁
KB2883200
,如果不是就下载和 安装它,然后再试一次(您可能需要在
之后重新启动 VM 安装 KB)。 检查您是否在 Test Agent VM 上启用了
PSRemoting
:远程到 VM,运行 PowerShell 管理员,运行 命令:
Enter-PSSession localhost
如果失败,则需要通过下面的 运行ning 启用 PSRemoting 命令:
Enable-PSRemoting
如果这不起作用或者它说它已经设置好了,那么试试 运行 以下命令:
Enable-PSRemoting -Force
此外,您可以参考以下文章手动配置WinRM服务:
好的,正如我之前在对原始 post 的更新中指出的那样,我已经(反复)用尽了 Andy 和其他地方提供的上述建议。
即使 'Enable-PSRemoting -Force' cmdlet 的执行已返回 "WinRM is already set up to receive requests on this computer. WinRM is already set up for remote management on this computer.",在测试代理服务器的管理控制台中(在 Local Computer Policy\Computer Configuration\Administrative Templates\Windows Components\Windows Remote Management (WinRM)\WinRM Service\
下),设置 'Allow remote server management through WinRM
' 被标记为 'Not configured
'。
我将其更新为“已启用”。
然后我在 Windows 防火墙中创建了一个新的入站规则(在上面更新 WinRM 服务配置时提示),配置为允许安全连接,通过默认的 TCP 端口 5985 添加我指定的构建服务器。
这解决了问题。