不能访问子目录的文件的blob [英] Can't access the blob file in sub directory

查看:339
本文介绍了不能访问子目录的文件的blob的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有在Azure的Blob存储无子容器(目录)。我只是用斜杠的文件名有虚拟子目录。

There is no sub container(directory) in Azure blob storage. I simply use slashes in file name for having virtual sub directory.

下面是例子。

http://apolyonstorage.blob.core.windows。净/横幅/本地/首页/ index.html的

容器名称:横幅

文件名:本地/首页/ index.html的

File Name : Local/Homepage/index.html

我上传文件和访问在Azure门户,而只是访问的链接,告诉资源失败,没有找到,但它实际上是存在的。

I upload the file and access it on Azure portal but simply accessing the link fail by telling resource is not found but it is actually exist.

为什么当我通过链接访问浏览器的失败?

Why it fails when i access it on browser by link ?

推荐答案

什么是BLOB容器上的ACL?对于一个blob是直接访问通过URL(或者换句话说匿名访问,一滴容器的ACL应该是的Blob 公开

What's the ACL on the blob container? For a blob to be accessible directly via URL (or in other words anonymous access, blob container's ACL should be either Blob or Public.

您可以使用下面的示例code键更改容器的ACL:

You can use the sample code below to change the container's ACL:

        CloudStorageAccount account = new CloudStorageAccount(new StorageCredentials(StorageAccount, StorageAccountKey), true);
        CloudBlobClient blobClient = account.CreateCloudBlobClient();
        var container = blobClient.GetContainerReference("your-container-name");
        BlobContainerPermissions permissions = new BlobContainerPermissions()
        {
            PublicAccess = BlobContainerPublicAccessType.Blob,//Or BlobContainerPublicAccessType.Container
        };
        container.SetPermissions(permissions);

这篇关于不能访问子目录的文件的blob的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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