开发者

Simplest Azure Storage Manipulation possible

I have the need to integrate some blob storage into an existing ASP.NET Mvc site

my hope is to be able to just add some references and then just do puts and gets

but I cannot find any simple example for how to do this (that hasn't been deprecated to the point it no longer works)

I have tried using StorageClient but CreateCloudBlobClient() doe开发者_如何学Gosn't seem to work.


Windows Azure Platform Training Kit has a guestbok demo that shows how to do that, its simple as:

// upload the image to blob storage
CloudBlobContainer container = blobStorage.GetContainerReference("guestbookpics");
string uniqueBlobName = string.Format("image_{0}.jpg", Guid.NewGuid().ToString());
CloudBlockBlob blob = container.GetBlockBlobReference(uniqueBlobName);
blob.Properties.ContentType = FileUpload1.PostedFile.ContentType;
blob.UploadFromStream(FileUpload1.FileContent);

You can download it at: http://www.microsoft.com/downloads/details.aspx?FamilyID=413e88f8-5966-4a83-b309-53b7b77edf78&displaylang=en


There is also an annotated example of Programming Windows Azure Blob Storage in One Page of Code (which I wrote many months ago - but a few months after your question was posted - but perhaps it will help someone else).


Just an additional consideration:

Depending on the content you store in the blobs and what kind of processing you need to do, you might be able to reference data directly from the web page.

The advantages of this model is that it offloads the web server from tunneling the content. You can also take advatnage of Windows Azure CDN.

BTW, this post explains this in more detail: Azure storage + shared access signatures

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜