如何连接Azure存储以从blob存储中读取.txt文件

SRA*_*SRA 4 windows cloud azure

任何人都可以让我知道如何从Azure Blob存储中读取文本文件?

use*_*559 15

这很简单:

string text = CloudStorageAccount.Parse("<your connection string>").CreateCloudBlobClient().GetBlobReference("path/to/the/blob.txt").DownloadText();
Run Code Online (Sandbox Code Playgroud)

当然,如果blob在公共容器中,您可以这样做:

string text = new WebClient().DownloadString("http://youraccount.blob.core.windows.net/path/to/blob.txt");
Run Code Online (Sandbox Code Playgroud)