问题描述
我正在尝试将图片上传到Windows Azure Blob存储.我找到了一个很好的例子,但是它依赖于Microsoft.WindowsAzure.StorageClient
程序集.我刚刚了解到,最新版本的Windows Azure SDK具有一个新的Microsoft.WindowsAzure.Storage
程序集,该程序集取代了旧的StorageClient
程序集.此新程序集使用新的concreate类型:CloudPageBlob
和CloudBlockBlob
.在新的程序集中,我使用了以下内容:
I'm trying to upload a picture to Windows Azure blob storage. I found a good example, but it relied on the Microsoft.WindowsAzure.StorageClient
assembly. I've just learned that the latest version of the Windows Azure SDK has a new Microsoft.WindowsAzure.Storage
assembly, which replaces the older StorageClient
assembly. This new assembly uses new concreate types: CloudPageBlob
and CloudBlockBlob
. With the new assembly, I used the following:
// Setup the blob
string blobAddress = "myPicture.png";
CloudBlob blob = container.GetBlobReference(blobAddress);
blob.Properties.ContentType = "image/png";
尽管有了新的程序集,我不确定该使用什么.如果我将图像上传到Blob存储中,是页面Blob还是块Blob?我不明白两者之间的区别.同时,我找不到有关两者之间差异的信息.有人可以帮我吗?
With the new assembly though, I'm not sure what to use. If I'm uploading an image into blob storage, is it a page blob or a block blob? I don't understand the difference between the two. At the same time, I can't find information about the difference between the two. Can someone please help me out?
推荐答案
旧库的CloudBlob.Upload *方法上传到块Blob.因此,在更新应用程序以使用新库时,可以改为使用CloudBlockBlob.
Old library's CloudBlob.Upload* methods upload to block blobs. Hence, when updating your application to use the new library, you can use a CloudBlockBlob instead.
有关块Blob和页面Blob的更多信息,请参考了解块Blob和页面Blob .
For more information on block blobs and page blobs, please refer to Understanding Block Blobs and Page Blobs.
这篇关于将图片上传到Windows Azure Blob存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!