Azure Blob存储在PUT上返回404 [英] Azure Blob Storage returns 404 on PUT

查看:149
本文介绍了Azure Blob存储在PUT上返回404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了新的Blob存储;将CORS设置为允许所有(*)来源;创建了新的容器(dev);将容器访问策略设置为容器".现在,当我尝试将文件(file.txt)上传到我的容器时,我得到404 ResourceNotFound指定的资源不存在."回复. 我向邮递员提出以下要求:

I created new blob storage; set CORS to allow all (*) origins; created new container (dev); set container access policy to "Container". Now when I'm trying to upload file (file.txt) to my container I get 404 ResourceNotFound "The specified resource does not exist." response. I make following request from Postman:

PUT /dev/file.txt HTTP/1.1
Host: mystorageaccount.blob.core.windows.net
x-ms-blob-type: BlockBlob
x-ms-date: Thu, 13 Oct 2016 09:00:00 GMT
x-ms-version: 2015-02-21
x-ms-blob-content-type: text/plain

可能是个问题吗?

推荐答案

将容器访问策略设置为容器"

set container access policy to "Container"

将容器访问策略设置为Container仅适用于读取操作.对于写操作,需要对请求进行身份验证.

Setting container access policy to Container will only work for read operations. For write operations, the requests need to be authenticated.

对于身份验证,您需要按如下所述创建Authorization标头:

For authentication, you would need to create an Authorization header as described here: https://msdn.microsoft.com/en-us/library/azure/dd179428.aspx.

一种替代方法是使用Shared Access Signature (SAS).您需要做的是创建一个至少具有Write权限的SAS Token,并使用该令牌(这是您的Blob网址+ SAS令牌)创建一个SAS URL.请参阅此链接以获取有关共享访问签名的更多详细信息: https://azure.microsoft.com/en-in/documentation/articles/storage-dotnet-shared-access-signature-part-1/.

An alternative to that is to make use of Shared Access Signature (SAS). What you need to do is create a SAS Token with at least Write permission and create a SAS URL with that token (which is your blob url + SAS token). Please see this link for more details about Shared Access Signature: https://azure.microsoft.com/en-in/documentation/articles/storage-dotnet-shared-access-signature-part-1/.

这篇关于Azure Blob存储在PUT上返回404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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