Azure Blob Storage returns 404 on PUT

只愿长相守 提交于 2019-11-30 09:41:24

问题


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

What might be a problem?


回答1:


set container access policy to "Container"

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

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

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/.



来源:https://stackoverflow.com/questions/40017960/azure-blob-storage-returns-404-on-put

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!