Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Web App- Could not establish trust relationship for the SSL/TLS secure channel

I have Web Job and Web API running on same Web App in Azure. Web Job access Web API over Https. But it throws below error while trying to access Web API:

An error occurred while sending the request. The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

like image 460
DevX Avatar asked Nov 21 '17 16:11

DevX


1 Answers

Add the following to your code, this sets your runtime to accept the SSL/TLS connection.

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
like image 144
kpasgma Avatar answered Sep 28 '22 14:09

kpasgma