RestSharp & TLS 1.1

Are there any known issues using RestSharp and TLS 1.1? We are currently using RestSharp to send mail inquiries to a supplier. This provider is no longer going to accept TLS 1.0 connections and is switching to TLS 1.1.

The problem is that they switch from TLS 1.0 to TLS 1.1, then the RestSharp code, which we no longer work with.

I tested this on 2008 R2 (after enabling registry settings for 1.1 and 1.2) as well as on Windows 8.1. They switch to TLS 1.1, and RestResponse:

"The connected connection was closed: an unexpected error occurred while sending"

Go back to TLS 1.0 and no problem. I tested access to their site using Google Chrome, and it shows TLS 1.1, so the server and client workstation can use TLS 1.1. This seems to be a RestSharp problem ...

+6
source share
1 answer

I did not find a way to configure RestSharp to use a different protocol. But you can override the default protocol in ServicePointManager before executing the queries:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11; 

This will solve the problem. You can also change the Windows registry settings to use TLS 1.1 / 1.2 by default. Here's more info in a related question.

+12
source

Source: https://habr.com/ru/post/987782/


All Articles