Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

System.Net.WebException: 'The request was aborted: Could not create SSL/TLS secure channel.'

(0) ShareShare
ReportReport
Posted on by 2
Hello Community,
 
I'm trying to implement a web api call in X++ (D365FO).
Unfortunately, I'm facing an issue during the execution of the GetReponse() method below.
 
Extract of X++ Code 

      str user = /xxxxx/;
      str pass = /xxxxxxxxxxxxxxxxxxx/;
      System.Text.Encoding encoding = System.Text.Encoding::UTF8;
   System.Byte[] bytes = encoding.GetBytes(user + /:/ + pass);
   System.String base64 = System.Convert::ToBase64String(bytes);

   System.String headerKey = /Authorization/;
   System.String headerValue = /Basic / + base64;
   request = System.Net.WebRequest::Create(API URL);

   System.Net.WebHeaderCollection headers = request.Headers;
   request.set_Headers(headers);
   request.Method = /GET/;

      response = request.GetResponse();

Error Message during the execution of GetResponse() Method
The request was aborted: Could not create SSL/TLS secure channel.
 
Investigating in this forum, it seems that some people faced this issue in the past, but I didn't find a clear fix.
Can someone please help ?
 
Thanks
 
Regards,

Samir
  • Suggested answer
    Kevin Xia Profile Picture
    Kevin Xia Microsoft Employee on at
    System.Net.WebException: 'The request was aborted: Could not create SSL/TLS secure channel.'
    Hi,
    You can check out this old thread where the questioner has a similar question to yours: "The request was aborted: Could not create SSL/TLS secure channel." On API Call (dynamics.com). It comes out to be the ciphers that were not configured on D365 FnO VMs
    Best regards,
    Kevin
  • System.Net.WebException: 'The request was aborted: Could not create SSL/TLS secure channel.'
    Hi Martin,
     
    Thx for your feedback.
    I've already tried this but it didn't work.
     
    Regards,
     
    Samir
  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,962 Most Valuable Professional on at
    System.Net.WebException: 'The request was aborted: Could not create SSL/TLS secure channel.'
    Try changing the security protocol to TLS 1.2:
    System.Net.ServicePointManager::SecurityProtocol = System.Net.SecurityProtocolType::Tls12;
     
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,160 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans