Custom .NET Activity: The request was aborted: Could not create SSL/TLS secure channel. Unable to download API data.

KathiresanSubramaniam-1168 1 Reputation point
2020-07-09T06:16:04.973+00:00

Under the Batch Service option, we are running a custom dot net activity, and that .NET tool downloads data from some APIs. It was working fine without any issues until Yesterday(for more than 2/3 years). Now we are facing the below error while downloading data from the APIs. I don't know why we are facing such issue suddenly.

Error: The request was aborted: Could not create SSL/TLS secure channel.
StackTrace: at System.Net.WebClient.OpenRead(Uri address)
at Import.DownloadSite(String url, String type)

The same .NET tool works fine in our local desktop machines(Windows 10 OS). Getting the error only in the batch account machine. So I think the problem is in the batch account machine.

Using the below C# code for downloading data from the APIs:

WebClient wc = new WebClient();
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
return wc.DownloadString(string.Format(ApiUrl, type));

I tried most of the solutions suggested in the below link, and nothting works for me.
https://stackoverflow.com/questions/2859790/the-request-was-aborted-could-not-create-ssl-tls-secure-channel

More information:
.NET Framework: v4.5
Batch machine: Windows Server 2012 R2 (x64)

Azure Batch
Azure Batch
An Azure service that provides cloud-scale job scheduling and compute management.
301 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,517 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. ChiragMishra-MSFT 951 Reputation points
    2020-07-10T10:19:47.08+00:00

    Hi @KathiresanSubramaniam-1168,

    You need to Add HTTP Header "Expect" with value "100-continue". In your case, please add these lines of code before creating the request :

     ServicePointManager.Expect100Continue = true;
     ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
            | SecurityProtocolType.Tls11
            | SecurityProtocolType.Tls12
            | SecurityProtocolType.Ssl3;
    

    Hope this helps.

    1 person found this answer helpful.

  2. Biman Mondal 1 Reputation point
    2020-08-05T13:14:50.037+00:00

    I am facing the same issue as mentioned in the original thread.

    log :
    [08/04/2020 17:39:27,846] VSTA_Main: URI: https://xxxx-d.openstack.sas.com/locales
    [08/04/2020 17:39:27,864] VSTA_Main: Method: GET
    [08/04/2020 17:39:27,884] VSTA_Main: ContentType:
    [08/04/2020 17:39:27,892] VSTA_Main: Accept:
    [08/04/2020 17:39:27,905] VSTA_Main: AcceptLanguage: en-US
    [08/04/2020 17:39:27,983] VSTA_Main: ReqBody: "en"
    [08/04/2020 17:39:28,011] --------------- EXCEPTION REPORT ---------------
    [08/04/2020 17:39:28,058] CreateNInitiateREST:
    [08/04/2020 17:39:28,070] System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
    at System.Net.HttpWebRequest.GetResponse()
    at SAS.FM.Common.RESTHelper.CreateNInitiateRESTRESPONSE
    [08/04/2020 17:39:28,096] ----------- END OF EXCEPTION REPORT ------------
    [08/04/2020 17:39:28,124] --------------- EXCEPTION REPORT ---------------
    [08/04/2020 17:39:28,153] Failed to reconnect with server.
    [08/04/2020 17:39:28,182] System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
    at System.Net.HttpWebRequest.GetResponse()

    0 comments No comments

  3. 17NBhoodoo 1 Reputation point
    2021-02-23T16:41:00.14+00:00

    by sam

    Error>
    <Code>ResourceNotFound</Code>
    <Message>The specified resource does not exist. RequestId:97a49709-101e-005a-5801-0a46fa000000 Time:2021-02-23T16:33:15.5463336Z</Message>
    </Error>

    0 comments No comments