Reputation: 3
**
** System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, bool async, Stream stream, CancellationToken cancellationToken)
AuthenticationException: Authentication failed because the remote party sent a TLS alert: 'HandshakeFailure'. System.Net.Security.SslStream.ForceAuthenticationAsync(TIOAdapter adapter, bool receiveFirst, byte[] reAuthenticationData, bool isApm) System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, bool async, Stream stream, CancellationToken cancellationToken)
Upvotes: 0
Views: 3337
Reputation: 5174
This error is mostly related to security protocol type.
It is most likely caused by your application's default security protocol type being set too low.
A lot of external APIs now expect requests using TLS 1.2 or above. You culd try to set the SecurityProtocol in your application by adding these code:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
This can be added just before you call the api, or it can even be added in the application start method.
In addition, there is another possibility for this problem, you can refer to the explanation of n-develop.
Hope this can help you.
Upvotes: 0