简体   繁体   中英

How to use WindowsAzure.Storage.DataMovement?

 TransferManager.UploadAsync(@"C:\data2.flac",
                             destinationBlob,
                             null,
                             context,
                             CancellationToken.None).Wait();

This code perfectly works when I upload to block blob storage.

How can I use WindowsAzure.Storage.DataMovement when I upload to page blob ?

Now I get

Unhandled Exception: System.AggregateException: One or more errors occurred. ---> Microsoft.WindowsAzure.Storage.DataMovement.TransferException: File size 274.02MB is invalid for PageBlob, must be a multiple of 512 bytes.

As the error message states, in order to upload a file as page blob the size of the file must be a multiple of 512 bytes. Because your file does not match this criteria, your upload is failing. You would need to specify a file which matches this size restriction.

The reason there's this size restriction is because you mount these page blobs as drives and use them with your Virtual Machines.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM