Arnab
Arnab

Reputation: 2354

Azure BlockBlob Upload From Stream always has content length 0

When I call "await blockBlob.UploadFromStreamAsync(stream);", I find that stream has a content length of some value(500+ bytes).

But once the call is made, I see that there is no change in the blockblob. I check it in fiddler and see the call made has a Entity content-length =0.

Would appreciate if someone could please guide how to debug a problem like this.

Thanks

Upvotes: 2

Views: 2072

Answers (2)

Paul0515
Paul0515

Reputation: 25435

The question was .. how to debug this? I had same issue, found this helpful doc to get tracing enabled:

Client-side Logging with the .NET Storage Client Library

My issue was when uploading using UploadFromStreamAsync azure file storage while the destination resource already existed (an overwrite action), the fileStream.Seek(0, SeekOrigin.Begin) was needed. When uploading (and creating) new resources, the seek was not required.

Upvotes: 1

casperkc
casperkc

Reputation: 81

Why are you converting the bytearray, instead of uploading it directly?

Like this:

blob.UploadFromByteArray(bytearray, 0, bytearray.Count());

Upvotes: 0

Related Questions