ContainerNotFound Error


  • Hi,


    I am creating an Azure storage blob container with its name as a GUID (lower case).

    account = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");
    nameOfContainer = containerName.ToLower();
    CloudBlobClient client = account.CreateCloudBlobClient();
    container = client.GetContainerReference(nameOfContainer);
    //set public access to the container
    var permission = container.GetPermissions();
    permission.PublicAccess = BlobContainerPublicAccessType.Container;itlinfosys
    and then creating blob as below
    string id = Guid.NewGuid().ToString().ToLower();
    string blobName = id + ":" + blobName + ".zip";
    CloudBlobClient client = account.CreateCloudBlobClient();
    CloudBlob blob = container.GetBlobReference(blobName);
    var metadata = new NameValueCollection();
    metadata["Id"] = id;
    metadata["BlobName"] = String.IsNullOrEmpty(blobName) ? "unknown" : blobName;
    metadata["Description"] = String.IsNullOrEmpty(description) ? "unknown" : description;
    metadata["Tags"] = String.IsNullOrEmpty(tags) ? "unknown" : tags;     
    // Add and commit metadata to blob
    if (orStream != null)
    blobURI = blob.Uri.ToString();

    At times (almost 50%), I get the error – “ContainerNotFound. The specified container does not exist.”

    Inner Ex.- “The remote server returned an error: (404) Not Found.”

    Stack Trace- “at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.get_Result()


       at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.ExecuteAndWait()


       at Microsoft.WindowsAzure.StorageClient.CloudBlob.UploadFromStream(Stream source, BlobRequestOptions options)”


    This error is not consistent. It is thrown sometimes and could not get any specific condition too when it will throw this error. I checked the Azure storage account through Azure storage explorer and it exists there.


    I put the trace on values of below which does not come properly in case of this error.


    container.Name = 3683ae5c-912a-4351-ac1b-e237386e5878


    blob.Uri =  (in case of no error it comes like


    blob.Container.Name = (in case of no error it comes like - 3683ae5c-912a-4351-ac1b-e237386e5878)


    blob.Container.Uri = (in case of no error it comes like - )


    Any suggestion in this would help me.




    Tuesday, December 21, 2010 8:38 AM


  • The following is documented for blob names:

    -- A blob name can contain any combination of characters, but reserved URL characters must be properly escaped.

    I would probably not use the colon character in a blob name.

    Using Fiddler to verify precisely what is sent over the wire to Azure Storage can often provide good information in cases like this.

    Tuesday, December 21, 2010 9:48 AM