【问题标题】:Connect Azure storage through Proxy .net core通过 Proxy .net core 连接 Azure 存储
【发布时间】:2021-07-22 03:09:46
【问题描述】:

连接到 Azure 存储时出现错误。 错误:重试 6 次后失败。 (不知道这样的主机。(shipfiles.blob.core.windows.net:443))

string downloadFilePath = @"C:\test.xlsx"; 尝试 {

        string connectionString = "DefaultEndpointsProtocol=https;AccountName=;AccountKey=HulI9Usin8D/PgATIYW3FQHS9yyxCB+zLVQCAb4MWq0fEyU63SZIyr9JtzI0iy1K/2Nur0dWyCgeSrknSe/aA==;EndpointSuffix=core.windows.net";
        BlobServiceClient blobServiceClient = new BlobServiceClient(connectionString);            
        string containerName = "samplecontainer";
        BlobContainerClient containerClient = blobServiceClient.GetBlobContainerClient(containerName);
        string filename = "TACSNTNA.xlsx";
        BlobClient blobClient = containerClient.GetBlobClient(filename);                
        BlobDownloadInfo download = blobClient.Download();            
        using (FileStream downloadFileStream = new FileStream(downloadFilePath,FileMode.OpenOrCreate))
        {
             download.Content.CopyToAsync(downloadFileStream);
            downloadFileStream.Close();
        }
        }
        catch (Exception ex)
        {

        }

【问题讨论】:

标签: azure asp.net-core .net-core azure-blob-storage


【解决方案1】:

添加以下代码并使用代理拨打电话。

我可以通过添加以下代码来使用它。 System.Environment.SetEnvironmentVariable("HTTPS_PROXY", "username:password@1.0.0.0:8080");

【讨论】:

    猜你喜欢
    • 2020-05-29
    • 2016-02-18
    • 2013-08-29
    • 1970-01-01
    • 2018-05-14
    • 2017-08-23
    • 2017-08-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多