Blob download throws Transport connection closed exception
-
2012년 3월 6일 화요일 오전 1:00
I am trying to download a blob from the blob storage. The blob is about 250 MB and is being downloaded as a stream. The code is given below
public void BlobStreamDownload(string containerName, string blobName, string FileName) { CloudBlobContainer container = BlobClient.GetContainerReference(containerName); CloudBlob blob = container.GetBlockBlobReference(blobName); //blob.DownloadToFile(FileName); <- same error using (Stream file = File.Create(FileName)) { blob.DownloadToStream(file); /* I am using SDK v1.6 *. } }
The exact exception message is "Unable to read data from the transport connection: The connection was closed". Where should I look for solution? Thank you.
- 편집됨 dinwal_pdc_guy 2012년 3월 6일 화요일 오전 1:43
모든 응답
-
2012년 3월 6일 화요일 오전 4:18
Hello.
I think that this problem can occur when:
1) nothing is here
2) timeout
Do you sure that your blob exist?
-
2012년 3월 6일 화요일 오전 4:43
Yes, I am sure because in my app the list is populated with all the blobs that are present in the container. Also, I am able to download 2 MB files without any issue. It is only with larger files.
- 편집됨 dinwal_pdc_guy 2012년 3월 6일 화요일 오전 4:47
-
2012년 3월 6일 화요일 오전 7:59중재자
Hi,
It may happened if your network connection is too slow (for example, download speed is less than 10 KB/s). If the network connection is fine, please try the download again. Please also check if your application/proxy/network has some limitations on the max response returned by a server.
Best Regards,
Ming Xu.
Please mark the replies as answers if they help or unmark if not.
If you have any feedback about my replies, please contact msdnmg@microsoft.com.
Microsoft One Code Framework -
2012년 3월 6일 화요일 오후 6:16
I agree with Ming - what download speeds are you getting? Are you able to task manager to see this? It'd be great to know how much of the file is downloading before you hit this error, and whether that value is consistent on each attempt.
-Jeff
-
2012년 3월 7일 수요일 오전 6:17Downloading speed is not an issue for sure. The net is about 100 MB/s at school. I use the API, how do I find out how much has been downloaded?
-
2012년 3월 7일 수요일 오후 5:50
Hi Dinesh -
Actually, the most likely cause for this is the timeout. By default, the download operations have a 90 second timeout. If the blob hasn't completed downloading in that time, then this exception will be thrown.
Create a BlobRequestOptions object like this (this one results in a 10 minute timeout - you should choose a time based on expected download rates and acceptable wait times):
BlobRequestOptions options = new BlobRequestOptions(); options.Timeout = new TimeSpan(0, 10, 0);
And then pass it in to the Download method. Hope that helps - if you increase this time, and you get the exception above in less time than the timeout specified, then there may be something else going on.-Jeff
- 답변으로 표시됨 dinwal_pdc_guy 2012년 3월 7일 수요일 오후 11:10
-
2012년 3월 7일 수요일 오후 11:10Thank you Jeff. I will try it and let you know if I have further questions.
-
2012년 5월 2일 수요일 오전 10:16
Hi I Think you should not download the BLOB as a whole.
Try dividing the stream into diffrent chunks and then download.
Best Regards,
Brij Mohan

