Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

error in download json from api - System.Net.WebException: 'The request was aborted: Could not create SSL/TLS secure channel.'

$
0
0

Hi All,

i'm trying to get data from rest api with token with "script component" in ssis.

 when the code is reaching the part of   return client.DownloadString(downloadURL) it fails

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

this is what i'm getting in the script component: runtime error:

   at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
   at System.Net.WebClient.DownloadString(Uri address)
   at System.Net.WebClient.DownloadString(String address)
   at ScriptMain.DownloadJson(String downloadURL) in c:\Users\320049665\AppData\Local\Temp\Vsta\624378d242724fcc9e5bf1dbf2294601\main.cs:line 26
   at ScriptMain.PreExecute() in c:\Users\320049665\AppData\Local\Temp\Vsta\624378d242724fcc9e5bf1dbf2294601\main.cs:line 17
   at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PreExecute()

this is the code:

using System;
using System.Net;
using System.Collections.Generic;
using System.Web.Script.Serialization;

[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
public class ScriptMain : UserComponent
{
    string json;

    public override void PreExecute()
    {
        base.PreExecute();
        string url = "https://www.xxx?Authrization=Bearer eyJhbGciOiJIUzxxxv4_NP7wg";
        json = DownloadJson(url);
    }

}

    public static string DownloadJson(string downloadURL)
    {
        using (WebClient client = new WebClient())
        {
            return client.DownloadString(downloadURL);
        }
    }

please help


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>