Azure uploadfromfileasync引发超时异常 [英] Azure uploadfromfileasync throws timeout exception
问题描述
blockBlob.uploadFromFileAsync()=>当文件的say(> 2 GB)较大时,客户端将在指定的超时时间内无法完成操作.我正在上传一个zip文件.
blockBlob.uploadFromFileAsync()=> throws the client could not finish the operation within specified timeout when the file is larger in say(>2 GB). I am uploading a zip file.
BlobRequestOptions blobrequestoption= new BlobRequestOptions
{
ParallelOperationThreadCount=64,
DisableContentMD5Validation=true,
storeBlobUploadContentMD5=false,
singleBlobUploadThreshholdInBytes=100*1024*1024
};
CancellationToken cancellationtoken=new CancellationToken();
IProgress<storageProgress> progresshandler=new Progress<StorageProgress>(
progress=> logger.consoleDebug(((progress.BytesTranserred)/(1024*1024)) +"transferred")
var _task=Task.run(()=> blockBlob.uploadFromFileAsync(sourceFilePAth, null, blobrequestoption,null,progressHandler,cancellationtoken));
_task.wait();
推荐答案
按照@GauravMantri指出,要解决超时
问题,您应该减小 ParallelOperationThreadCount 的值.代码>从64到适当的数字.最大值不应超过计算机上逻辑处理器的数量.
As per @GauravMantri pointed out, to fix the time out
issue, you should reduce the value of ParallelOperationThreadCount
from 64 to a proper number. Maximum value should not be more than the number of logical processors on your computer.
并且 singleBlobUploadThreshholdInBytes
值设置为100MB在某些情况下可能会导致 timeout
问题,例如在网络状况不佳的情况下.您可以将其设置为较小的大小,例如4MB.
And the singleBlobUploadThreshholdInBytes
value setting as 100MB might cause the time out
issue in some cases, like in a bad network situation. You can set it to a smaller one like 4MB.
这篇关于Azure uploadfromfileasync引发超时异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!