使用Blob URL直接访问图像时出错
我是Azure的新手。我已经激活了免费订阅以学习Azure。我在门户网站上创建了一个存储帐户。在该帐户中,我创建了一个容器。
我成功地将图像上传到了该容器。当我单击该图像时,我发现了可以使用浏览器访问的属性中的URL。
但是在执行上述操作时,我要低于错误。
<Error>
<Code>ResourceNotFound</Code>
<Message>
The specified resource does not exist. RequestId:<Guid> Time:2022-05-17T11:20:46.2299517Z
</Message>
</Error>
但是图像确实存在于该容器中。为什么我会遇到上述错误?如何避免此错误?
I am new to Azure. I have activated my free subscription to learn Azure. I have created one Storage account in my portal. In that account, I created one container.
I uploaded an image to that container successfully. When I click that image, I have found the URL in properties that I can use to access via browser.
But I am getting below error while performing the above operation.
<Error>
<Code>ResourceNotFound</Code>
<Message>
The specified resource does not exist. RequestId:<Guid> Time:2022-05-17T11:20:46.2299517Z
</Message>
</Error>
But the image does exist in that container. Why am I getting the above error? How do I avoid that error?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我已经在环境中进行了测试。请注意,当您创建一个新容器时,默认情况下它的访问级别将是私有的。
请检查您的容器的访问级别
私有
或不喜欢以下内容:转到Azure Portal -&gt;存储帐户 - &GT;您的存储帐户 - &GT;容器 - &GT;您的容器“公共访问级别”
如果该访问级别为
private
,当您访问Blob时该容器直接通过浏览器,您将获得如下所示的错误:更改容器的访问级别:
选择启用
更改访问的容器Level
选项 - &gt;选择更改访问级别 - &GT;选择blob
或container
从下拉菜单 - &gt;单击OK现在,直接通过浏览器访问blob URL,将没有问题。
I have tested in my environment. Please note that, when you are creating a new container, it's access level will be private by default.
Please check the access level of your container is
Private
or not like below:Go to Azure Portal -> Storage Accounts -> Your Storage Account -> Containers -> Your Container "Public access level"
If that access level is
private
, when you access the blob of that container directly via browser, you will get error like below:To change the access level of your container:
Select your container that enables
Change Access level
Option -> Select Change Access Level -> SelectBlob
orContainer
from the dropdown -> Click OkNow, access the blob URL directly via browser, there will be no issues.
就我而言,(我收到相同的错误),我的容器是公共的(blob),并且所有访问权限设置了正确。
我的问题是,当我使用azure.storage.blobs名称空间上载图像时:
图像上载了错误的内容类型。
对于图像,内容类型需要为“图像/JPEG”。当使用Azure网站上传图像时,内容类型会自动设置为Image/jpeg,但是,当以编程方式上传时,内容类型是不同的(忘记了它是什么,某物...流)。当我手动修改文件的内容类型时,URL开始神奇地工作。
因此,我使用以下代码上传文件并设置正确的内容类型。
blobcnnstr变量包含存储帐户访问键连接字符串,
CONNAMERNAME变量包含容器名称,
文件名变量包含没有路径的文件名,
FilefullyQualifiedName变量包含路径 +文件名。
希望这对某人有帮助。
In my case, (I was receiving the same error), my container was public (blob), and all the access was set properly.
My problem was that when I uploaded the images using the Azure.Storage.Blobs namespace, for example:
the image uploaded with a wrong CONTENT-TYPE.
For images, content type needs to be "image/jpeg". When image is uploaded using Azure web site, the content type is set automatically to image/jpeg, however, when uploading programmatically, the content type is different (forgot what it was, something...stream). When I would modify the content type for a file manually, the URL started working magically.
So I used the following code to upload the files and set the correct content type.
blobcnnstr variable contains the Storage Account Access Key connection string,
containername variable contains container name,
filename variable contains file name without the path,
filefullyqualifiedname variable contains path + filename.
Hope this help someone.