Home > Back-end >  Authentication failed because the remote party sent a TLS alert when invoking a 3rd party API
Authentication failed because the remote party sent a TLS alert when invoking a 3rd party API

Time:11-09

I have a Blazor Server Application that is invoking a 3rd party API using IHttpClientFactory. When I execute the calling code on my local Windows 11 machine I receive the exception below. However, If I run the same code from an Azure Web App, the API is called successfully.

  Error: System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
  System.Security.Authentication.AuthenticationException: Authentication failed because the remote party sent a TLS alert: '112'.

I have attempted setting the Security protocol to TLS1.2 using the ServicePointManager, however, this does not make a difference. I have run Wireshark to glean some additional information, but all I can see is that my machine is initiating the call with TLS 1.2.

Does anyone have an idea as to why my code works in Azure, but not in my local development environment?

CodePudding user response:

According to the behavior in azure web app, I think the issue should related to environment.

And if you have another os version pc, you can test it, and it should be work normally.

And I found the workaround in win11. You can add the registry key and removed the code to set the protocol to TLS1.2, and the TLS handshake worked from your Windows 11 system.

  • Related