从阅读的Azure Blob存储文件 [英] Read file from Azure blob storage
本文介绍了从阅读的Azure Blob存储文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要读Azure存储为PDF文件的字节,对于我有一个文件路径。
I want to read a PDF file bytes from azure storage, for that I have a file path.
https://hostedPath/pdf/1001_12_Jun_2012_18_39_05_594.pdf
因此,可以通过读取直接传递的路径名,从Blob存储的内容?另外,我使用C#。
So it possible to read content from blob storage by directly passing its Path name? Also I am using c#.
推荐答案
只要将BLOB的公共的,你可以完全通过BLOB网址。例如,你可以将它嵌入在HTML图像或链接:
As long as the blob is public, you can absolutely pass the blob url. For instance, you can embed it in an html image or link:
<a href="https://myaccount.blob.core.windows.net/pdf/1001_12_Jun_2012_18_39_05_594.pdf">click here</a>
在默认情况下,BLOB容器的私人的。为了让公共读取权限,你只需要创建容器时改变容器的权限。例如:
By default, blob containers are private. To enable public read access, you just have to change the container permissions when creating the container. For instance:
var blobStorageClient = storageAccount.CreateCloudBlobClient();
var container = blobStorageClient.GetContainerReference("pdf");
container.CreateIfNotExist();
var permissions = container.GetPermissions();
permissions.PublicAccess = BlobContainerPublicAccessType.Container;
container.SetPermissions(permissions);
这篇关于从阅读的Azure Blob存储文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文