HttpClient - throwing connection refused when using Https

If you make a simple HTTS request using HttpClient and you get an exception message saying "connection has been refused by remote host", then most likely is you're using .Net 4.5 or below which does not support HTTPS request.

Upgrade your project to .Net 4.6 and you're good.

Updates :- In case you still facing the issue in your Web Project like ASP.Net MVC, please try  adding the following code before you make a https request :

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

Here's a sample implementation code :


Popular posts from this blog

ionic2 cordova build android - Unable resolve gradle 2.2.3

A quick tutorial for OWASP ZAP tool for beginners