Ошибка: ошибка загрузки файла: ответ SSL-сертификата, полученный от сервера, недействителен. Невозможно обработать запрос.
Выполняем часть задания SSIS в Visual Studio (Загрузить задачу файла NPI), которую мы получаем, и ошибка, показанная выше, хотя я загрузил сертификат с веб-сайта и установил его с помощью MM C. Прилагаю код, который мы используем, в надежде, что кто-то может помочь
{
bool repeat = true;
string tmpFileName = null;
try
{
string npiWebAddress = (string)Dts.Variables["$Project::NPI_File_Web_Address"].Value;
string inBoxPath = Path.Combine((string)Dts.Variables["$Project::CSV_File_Root_Folder"].Value, (string)Dts.Variables["$Project::Inbox_Folder"].Value);
string zipFilePath = Path.Combine((string)Dts.Variables["$Project::CSV_File_Root_Folder"].Value, (string)Dts.Variables["$Project::Zip_Files_Folder"].Value);
Directory.CreateDirectory(inBoxPath);
Directory.CreateDirectory(zipFilePath);
DateTime monday = DateTime.Today.AddDays((int)DayOfWeek.Monday - (int)DateTime.Today.DayOfWeek).AddDays(-7);
DateTime sunday = monday.AddDays(6);
if (string.IsNullOrWhiteSpace(npiWebAddress))
{
Dts.Events.FireInformation(105, "DownloadNpiFile", "NPI Download Disabled, NPI_File_Web_Address is blank", "", 0, ref repeat);
Dts.TaskResult = (int)ScriptResults.Success;
return;
}
// reserve a temp file to hold the downloaded zip file
tmpFileName = Path.GetTempFileName();
// first try to download a monthly full listing zip file
bool fileDownloaded = DownloadMonthlyFile(sunday, npiWebAddress, zipFilePath, tmpFileName);
if(fileDownloaded)
{
UnzipCsvFile(monday, sunday, true, tmpFileName, inBoxPath);
}
else
{
// try to download a weekly update zip file if we did not download a monthly file
fileDownloaded = DownloadWeeklyUpdateFile(monday, sunday, npiWebAddress, zipFilePath, tmpFileName);
if(fileDownloaded)
{
UnzipCsvFile(monday, sunday, false, tmpFileName, inBoxPath);
}
}
// move the zip file to the network share if a file was downloaded
if (fileDownloaded && _zipFileFullPath != null)
{
File.Move(tmpFileName, _zipFileFullPath);
tmpFileName = null;
}
Dts.TaskResult = (int)ScriptResults.Success;
}
catch (Exception ex)
{
Dts.Events.FireError(1000, ex.Source, ex.Message, "", 0);
Dts.TaskResult = (int)ScriptResults.Failure;
}
finally
{
if(tmpFileName != null)
{
File.Delete(tmpFileName);
}
}
} ```