PUT 上的 Azure Blob 存储 returns 404

Azure Blob Storage returns 404 on PUT

我创建了新的 blob 存储;将 CORS 设置为允许所有 (*) 来源;创建了新容器(dev);将容器访问策略设置为 "Container"。现在,当我尝试将文件 (file.txt) 上传到我的容器时,我收到 404 ResourceNotFound "The specified resource does not exist." 响应。 我向邮递员提出以下要求:

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 将仅适用于读取操作。对于写入操作,需要对请求进行身份验证。

对于身份验证,您需要创建一个 Authorization header,如下所述:https://msdn.microsoft.com/en-us/library/azure/dd179428.aspx.

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