简体   繁体   中英

HTTPS GET API call error- Could not create SSL/TLS secure channel.- Unable to connect to the remote server

I moved my web app to a new server (IIS) with my SSL. When I try to make a web request from my new server to other servers with https, I get these errors on different server endpoints:

  • Could not create SSL/TLS secure channel.
  • Unable to connect to the remote server

I didn't change my code. My web app was working at old server. At my development environment (localhost), I can call HTTPS API calls successfully.

Why I am gettting these errors?

I tried these solutions:

ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, errors) => true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

When you moved to a different web server the host name would have changed. Consequently, you would have to either regenerate the certificate with the new host name or would have to somehow change the new server's host name to the old host name. This is the basic thing to check for starters.

Solution: Visit https URLs with Internet Explorer at your server. If you can't get any response go to:

IE > Tools > Internet Options > Advanced > Settings > Security

Select TLS and SSL protocols and ciphers which your https endpoint needs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM