如何使用asp.net从azure中的不同blob下载文件? [英] How to download files from different blobs in azure using asp.net?

查看:74
本文介绍了如何使用asp.net从azure中的不同blob下载文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我想使用asp.net从天蓝色存储中的不同blob下载图像文件?

可以任何一个告诉我一步一步的过程?



谢谢

krishna

Hi All,

I want to download image files from different blobs in azure storage using asp.net?
Can any one tell me step by step process?

Thanks
krishna

推荐答案

嗨murali,

使用这个



hi murali ,
use this

// Retrieve storage account from connection string.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
    CloudConfigurationManager.GetSetting("StorageConnectionString"));

// Create the blob client.
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

// Retrieve reference to a previously created container.
CloudBlobContainer container = blobClient.GetContainerReference("mycontainer");

// Retrieve reference to a blob named "photo1.jpg".
CloudBlockBlob blockBlob = container.GetBlockBlobReference("photo1.jpg");

// Save blob contents to a file.
using (var fileStream = System.IO.File.OpenWrite(@"path\myfile"))
{
    blockBlob.DownloadToStream(fileStream);
}





点击此链接获取azure docs


这篇关于如何使用asp.net从azure中的不同blob下载文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆