如何解决低带宽上传中的Azure Blob存储
我正在使用Azure Blob存储上载文件。此.Net Core
CLI应用程序在我的本地环境中运行以上传文件,在较高带宽下可以正常工作;当我以较低带宽(Exception被捕获,并显示一条消息“重试失败”。不仅大文件(1GB),有时小文件(300MB)也会失败,大文件会通过。
//代码
int timeOut = 150;
BlobClientOptions bco= new BlobClientOptions {
Transport = new HttpClientTransport(
new HttpClient { Timeout = TimeSpan.FromMinutes(timeOut) }),Retry = {NetworkTimeout = TimeSpan.FromMinutes(timeOut) }
};
var blcl = new BlobClient(new Uri("url"),bco);
var overWrite= await blcl.ExistsAsync();
var transOp = new StorageTransferOptions();
transOp.MaximumConcurrency = 5;
transOp.MaximumTransferSize=2;
using (FileStream file = File.OpenRead("filePath"))
{
//Here the upload file will synchronize to get JSON output
await blcl.UploadAsync(file,overWrite);
}
var blobProp = await blcl.GetPropertiesAsync();
我有什么可以更改或优化的方法来解决该随机问题?
无论如何将其更改为以块/块的形式发送以克服此故障?
文件大小::2-4 GB(但即使有500MB,也会发生异常)
发生异常:
catch (Exception e)
{
result.Status = "Fail";
result.Message = e.Message;
}
详细错误:
[{"Message":"Retry failed after 6 tries. (The operation was canceled.) (The operation was canceled.) (The operation was canceled.) (The operation was canceled.) (The operation was canceled.) (The operation was canceled.)"}
Azure Storage Blob版本: 12.4.4
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。