The specified container does not exist

后端 未结 2 1396
别那么骄傲
别那么骄傲 2021-02-20 10:12

Am stuck with this error The specified container does not exist.

let me explain,

CloudBlobClient blobStorage = GetBlobStorage(\"upload\");
C         


        
相关标签:
2条回答
  • 2021-02-20 11:06

    Short version

    Try the following code for BlobPropertySetting function:

     public static CloudBlockBlob BlobPropertySetting(CloudBlobClient cloudBlobClientReferenceName, string blobContentName)
        {
            CloudBlockBlob blob = cloudBlobClientReferenceName.GetBlockBlobReference("upload/" + blobContentName);
            return blob;
        }
    

    Now for the longer version :)

    The reason you're getting this error is because of the way you are constructing the CloudBlockBlob object in BlobPropertySetting method. When you use your code, it creates a blob object with the following URI: https://duv.blob.core.windows.net/blobContentName. If you notice, there's no container name there. Since there's no container name, storage client library assumes that you're trying to create a blob in $root blob container which is a special blob container. You can read more about it here: http://msdn.microsoft.com/en-us/library/windowsazure/hh488356.aspx. Since your storage account does not have this container, you get 404 - Resource Not Found error.

    0 讨论(0)
  • 2021-02-20 11:11

    I am very late, but still thought if my answer would be useful for anyone.

    I resolved this error by putting the correct "container name". It was different by default. I have cloned this GIT project : https://github.com/Azure-Samples/storage-blob-upload-from-webapp-node

    const
          express = require('express')
        , router = express.Router()
        , azureStorage = require('azure-storage')
        , blobService = azureStorage.createBlobService()
        , containerName = 'container' // added container name here, as my container name
        , config = require('../config')
    ;
    
    0 讨论(0)
提交回复
热议问题