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

Notifications

Announcements

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);
    }
}
I have the same question (0)
  • 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

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 763 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 413 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 284 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans