Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Azure: length of blob remains 0

I'm confused about how to get size of the blob in Windows Azure.

In my case, I first get the blob reference with CloudBlockBlob blob = container.GetBlockBlobReference(foo);(here foo is name of blob and I'm sure the blob exists). Then I try to get blob size blob.Property.Length; However, it always return 0. I breakpoint at this statement and track content inside blob: uri of the blob is correct, can I infer that the blob is correctly retrieved from that? While all the fields in Properties is either null or 0. I cannot figure out a solution. Is it because I currently emulate the app locally in Storage Emulator and will be OK after the deployment?

Thanks and Best Regards.

like image 477
Summer_More_More_Tea Avatar asked May 02 '12 02:05

Summer_More_More_Tea


2 Answers

Call blob.FetchAttributes(). GetBlockBlobReference doesn't actually make any calls to the blob service. It just constructs a local object that represents the blob.

like image 182
user94559 Avatar answered Oct 18 '22 04:10

user94559


I have written a blog on exact same issue about 4 days back:

http://blogs.msdn.com/b/avkashchauhan/archive/2012/04/27/windows-azure-blob-size-return-0-even-when-blob-is-accessible-and-downloaded-without-any-problem.aspx

like image 31
AvkashChauhan Avatar answered Oct 18 '22 04:10

AvkashChauhan