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

Hi,
I have similar case. Created on MS SQL SSIS package that connection to asana using PAT for auth ( https://app.asana.com/api/1.0/, Headers → “Authorization: Bearer " + “PAT”),
package sent get with parameters :
• portfolios/XXXXXXXXXXXXXX/items resource_type=project&limit=100&opt_fields=archived,color,created_at,current_status,custom_fields,default_view,due_on,due_date,followers,is_template,members,modified_at,name,notes,owner,permalink_url,public,resource_type,start_on,workspace,team,assignee • projects/XXXXXXXXX/tasks ?opt_fields=permalink_url,name,assignee_status,resource_type,resource_subtype,start_on,due_on,due_at,completed,completed_at
In general package runs with status successful, but from time to time every day ( can be 5-9 times per day) I have seen next error: “The request was aborted: Could not create SSL/TLS secure channel”.
In case of job failed, job trying to run package again, (can be 4 times) after that job will complete with status successful. So it will be great to resolve this issue.
Thanks in advance.
Windows 2012 r2 str.
MS SQL server 2017 cu24.

More recent versions of windows uses the good tls/ssl channel, but old windows like 2012 r2 may not.

You need to edit the registry
Cannot create SSL/TLS secure channel when for Project Online OData from SSIS - Office 365 | Microsoft Docs

Or, if you do it from dotnet code, you can add these lines:
c# - The request was aborted: Could not create SSL/TLS secure channel - Stack Overflow

I suppose the result is random because asana uses a collection of servers and, randomly, you are on one that does not accepts old ssl protocols.

1 Like

The error is generic and there are many reasons why the SSL/TLS negotiation may fail. ServicePointManager.SecurityProtocol property selects the version of the Secure Sockets Layer (SSL) or Transport Layer Security (TLS) protocol to use for new connections; existing c# connections aren’t changed. Make sure the ServicePointManager settings are made before the HttpWebRequest is created, else it will not work. Also, you have to enable other security protocol versions to resolve this issue:

ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
     SecurityProtocolType.Tls
     SecurityProtocolType.Tls11
     SecurityProtocolType.Ssl3;
 
//createing HttpWebRequest after ServicePointManager settings
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://google.com/api/")

If you create HttpWebRequest before the ServicePointManager settings it will fail and shows the error message.

1 Like