RestSharp & TLS 1.1

Jacob Dixon picture Jacob Dixon · May 23, 2015 · Viewed 12.5k times · Source

Are there any known issues with using RestSharp & TLS 1.1? We currently use RestSharp to send post requests to a vendor. This vendor is no longer going to accept TLS 1.0 connections and changing to TLS 1.1.

The problem is when they switch from TLS 1.0 to TLS 1.1 then the RestSharp code we have no longer works.

I've tested this on 2008 R2 (after enabling registry settings for 1.1 and 1.2) and also on Windows 8.1. They switch to TLS 1.1 and the RestResponse is:

"The underlying connection was closed: An unexpected error occurred on a send"

Switch back to TLS 1.0 and no problem. I've tested access their site using Google Chrome and it does show TLS 1.1 so the server and client workstation are able to use TLS 1.1. It just seems to be RestSharp that is the issue...

Answer

Vladislav Kostenko picture Vladislav Kostenko · Aug 24, 2015

I haven't found any way to configure RestSharp to use different protocol. But you can override default protocol in ServicePointManager before making requests:

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

This solve the issue. You can also change Windows Registry settings to use TLS 1.1/1.2 by default. Here is more info in related question.