0

I'm actually facing one problem calling ibmcloud web services using RestSharp version 105.2.3 to use .NET 4.0 project.

var client = new RestClient("https://api.eu.apiconnect.ibmcloud.com");
var request = new RestRequest();
var response = client.Execute(request);

This call is giving error

"La connexion sous-jacente a été fermée : Une erreur inattendue s'est produite lors de l'envoi." 

the corresponding error in English is

"The underlying connection was closed"

when using simple browser i get

<errorResponse><httpCode>404</httpCode><httpMessage>Not Found</httpMessage><moreInformation>The requested URL was not found on this server</moreInformation></errorResponse>

When i make a simple test using version 106.5.4 it's working fine.

Can you help me to know what is the difference between the two versions and if it's possible to make this call work in .Net 4.0?

Thanks

onicollet
  • 83
  • 1
  • 1
  • 3

1 Answers1

0

I finally got the answer on this page The request was aborted: Could not create SSL/TLS secure channel

The solution to this, in .NET 4.5 is

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

If you don’t have .NET 4.5 then use

ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
onicollet
  • 83
  • 1
  • 1
  • 3