web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Request was aborted could not create ssl/tls secure channel

(1) ShareShare
ReportReport
Posted on by 3,045
 
Hi All,
 
I am getting below error while trying to consuming the third party API.
 
Error: Request was aborted could not create ssl/tls secure channel 
 
Code: 
    str                         destinationUrl;
    System.Net.HttpWebRequest   request;
    System.Net.HttpWebResponse  webResponse;
    System.Object               response;
    System.IO.Stream            requestStream, responseStream;
    System.IO.StreamWriter      streamWriter;
    System.IO.StreamReader      streamReader;
    System.Net.WebHeaderCollection httpHeader;
    str                             requestJson;
    
    
    destinationUrl = connectorParameter.ITEHostnameURL;   
    try
    {
        httpHeader = new System.Net.WebHeaderCollection();
        new InteropPermission(InteropKind::ClrInterop).assert();
        System.Net.ServicePointManager::set_Expect100Continue(true);
        System.Net.ServicePointManager::set_SecurityProtocol(System.Net.SecurityProtocolType::Tls12);
        request     = System.Net.WebRequest::Create(destinationUrl);
       
        requestJson=_requestJson;
        httpHeader.Add('register_tenantName',connectorParameter.ITEConnectorTenantName);
        httpHeader.Add('register_custom_data_system_codes',connectorParameter.ITEConnectorUser);
        httpHeader.Add('register_date','1554308420');
        request.set_Headers(httpHeader);
        request.set_KeepAlive(true);
        request.Method = 'POST';
        request.ContentType = 'application/json';
        requestStream = request.GetRequestStream();
        streamWriter = new System.IO.StreamWriter(request.GetRequestStream());
        streamWriter.Write(requestJson);
        streamWriter.Flush();
        streamWriter.Close();
        response = request.GetResponse();
        webResponse     = response;
        responseStream  = webResponse.GetResponseStream();
        streamReader    = new System.IO.StreamReader(responseStream);
        responseStream.Close();
    }
    catch(Exception::Error)
    {
        SysInfologEnumerator    sysInfologEnumerator;
        str                        excecption;
        
        sysInfologEnumerator    = SysInfologEnumerator::newData(infolog.infologData());
        excecption              = sysInfologEnumerator.currentMessage();
        info(excecption);
    }
}
  • Suggested answer
    Hana Xue Profile Picture
    Microsoft Employee on at
    Hi,
    The link below mentions that this SSL/TLS trust relationship issue may manifest in various environments and platforms, including API links, etc. Depending on the context or the software you're using, the error message may differ slightly, but the essence remains the same. The main reason may be due to certificate issues. For detailed information, you can check this blog. Hope it will be helpful: https://10web.io/blog/could-not-establish-trust-relationship-for-the-ssl-tls/
    Best Regards,
    Hana
  • Suggested answer
    Pooja Karki Profile Picture
    3,045 on at
    Hi,
     
    My issue is resolved in DevBox by default required TLS cipher's are not enable. We have enable that using below powershell command.
     
    Enable-TlsCipherSuite -Name "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384"
    Enable-TlsCipherSuite -Name "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256"
     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 426 Most Valuable Professional

#2
CU10121822-0 Profile Picture

CU10121822-0 358

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 353 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans