TFS rest api调用-restmethod“基础连接已关闭:接收时发生意外错误". [英] TFS rest api Invoke-restmethod "The underlying connection was closed: An unexpected error occurred on a receive"

查看:104
本文介绍了TFS rest api调用-restmethod“基础连接已关闭:接收时发生意外错误".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Azure DevOps的发布管道中的powershell任务之一中调用TFS和/或Azure DevOps REST Api.我尝试在两个不同的服务器(安装了azure管道代理)中运行相同的rest api代码,但是其中一个正在运行,并且其中一个返回底层连接已关闭:接收时发生意外错误.".这两个代理服务器均启用了tls 1.1和1.2.工作服务器具有Powershell v 4.0,返回错误的服务器具有v5.0.

I am trying to invoke TFS and/or Azure DevOps REST Api in one of the powershell tasks in release pipeline in Azure DevOps. I tried running the same rest api code in two different servers (w/ azure pipeline agent installed) but one of them is working and one of them returns "The underlying connection was closed: An unexpected error occurred on a receive..". The two agent servers have both tls 1.1 and 1.2 enabled. the working server has powershell v 4.0 and the server that returns error has v5.0.

当我运行"[Net.ServicePointManager] :: SecurityProtocol"时,两个服务器都返回了ssl3 Tls.

When I ran "[Net.ServicePointManager]::SecurityProtocol," both servers returned ssl3, Tls.

我有一种解决方法,该服务器通过使用返回错误[Net.ServicePointManager] :: SecurityProtocol = [Net.SecurityProtocolType] :: Tls12但是我想知道为什么我需要在其中一台服务器上强制使用TLS 1.2,而当其他服务器似乎具有相同的TLS配置时才强制使用它们.

I have a workaround for the server that returns error by using [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 but I would like to know why I need to force using TLS 1.2 on one of the servers and not the others when they seem have same TLS configuration.

推荐答案

在不了解服务器的其他知识的情况下,可能会使用PowerShell V4在该服务器上设置注册表项设置.

Without knowing much else of the server, a registry key setting might be set on that server with PowerShell V4.

您可以检查以下reg键,以查看它们是否具有以下属性:

You can check the following reg keys to see if they have the following properties:

'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord


'HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord 

这篇关于TFS rest api调用-restmethod“基础连接已关闭:接收时发生意外错误".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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