Search code examples
c#azureconnection-stringazure-blob-storage

azure blob storage "No valid combination of account information found"


I have an MVC4 project that I am running using Azure websites preview.

My problem is that I cant upload a blob into my blob storage container when I have deployed my website to azure, however the upload works fine when I'm debugging locally.

This is the exception and stack trace I get when deployed and I try to upload to a container:

No valid combination of account information found. at Microsoft.WindowsAzure.Storage.CloudStorageAccount.b__0(String err) at Microsoft.WindowsAzure.Storage.CloudStorageAccount.TryParse(String s, CloudStorageAccount& accountInformation, Action`1 error) at Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse(String connectionString) at MyProj.Controllers.ImageController.Upload(ImageViewModel model)

Specifically as per the stack trace it is the .Parse method which is failing.

The code I am using to connect to the blob storage is straight from the azure how-to documentation:

string connectionString = ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString;
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

Once again, this works fine when I running locally on my dev box, I can upload successfully with no problems. However it gives me this error when deployed and I attempt to do exactly the same thing.

I'm guessing my storageConnectionString is being messed with during the web deploy publish process but I'm unsure about how to resolve this?


Solution

  • Store your storage connection string in AppSettings, not in ConnectionStrings section. And, pasting here the actual connection string will help us help you (you may put * for the account key).