简体   繁体   中英

Connect Azure storage through Proxy .net core

I am getting error while connecting to azure storage. Error:Retry failed after 6 tries. (No such host is known. (shipfiles.blob.core.windows.net:443))

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

        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)
        {

        }

Add below code and use proxy to make call.

I could use it by adding below code. System.Environment.SetEnvironmentVariable("HTTPS_PROXY", "username:password@1.0.0.0:8080");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM