How to troubleshoot the exception, Could not create TLS secure channel?

Kuler Master 266 Reputation points
2024-07-12T14:24:34.8133333+00:00

Hello there,

I have this C# code that consumes a SOAP WS and it was working properly for years. However, since recently it started to throw the following exception:

The request was aborted: Could not create SSL/TLS secure channel.

Basically it imports the certificate FILE (.pfx) needed for authentication.

request.ClientCertificates.Add(new X509Certificate(certificateFile, certPassword));

Well, it works 9 times as expected and then the 10th time it will not add the certificate. This results in getting Error 403 (Forbidden).

Honestly, I have no clue how to troubleshoot this issue especially because it happens only sporadically.

I checked the IIS Logs and found nothing helpful.

Your comments and suggestions would be greatly appreciated.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,371 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,405 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,615 questions
ASP.NET API
ASP.NET API
ASP.NET: A set of technologies in the .NET Framework for building web applications and XML web services.API: A software intermediary that allows two applications to interact with each other.
317 questions
{count} votes