问题
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