Azure blob storage exception "An existing connection was forcibly closed by the remote host"

Viewed 4707

I'm trying to use azure blob storage. I uploaded some images successfully, but all the sudden I get the error:

An existing connection was forcibly closed by the remote host

I looked into it and the exception is thrown whenever I try to check if a blob container exists.

This is my code:

BlobClient getter property: (note, I have marked sensitive data in the connection string with **)

static string connectionString = "DefaultEndpointsProtocol=https;AccountName=**;AccountKey=**;BlobEndpoint=https://**.blob.core.windows.net/;TableEndpoint=https://**.table.core.windows.net/;QueueEndpoint=https://**.queue.core.windows.net/;FileEndpoint=https://**.file.core.windows.net/";
public static CloudBlobClient BlobClient
{
            get
            {
                // Retrieve storage account from connection string.
                CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);

                // Create the blob client.
                CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
                return blobClient;
            }
}

The actual code throwing the exception:

 CloudBlobContainer container = BlobClient.GetContainerReference(containerName);
 if (!container.Exists())

To be precise, the exception occurs at the line where I check if the container exists.

I have no idea what's wrong. I am positive that the connection string is right(I copied it in).

I would REALLY appreciate if someone could tell me what the issue possibly could be.

2 Answers
Related