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?
Be sure that
1) You are using the proper protocol for diagnostics (double click the role -> configuration tab -> select the configuration -> under "Diagnostics", click the ellipsis -> try to click OK...if it gives error that you must use https, change the connection strings to https)
and
2) No white spaces allowed...i.e.
UseDevelopmentStorage=true;DevelopmentStorageProxyUri=https://127.0.0.1
instead of
UseDevelopmentStorage=true; DevelopmentStorageProxyUri=https://127.0.0.1
(note space after the semi-colon)
Check for https and white space in all connection strings on the Settings tab
---EDIT----
Putting "https" in actually screwed everything up for us. Worker role would throw an exception ("Handshack failed due to an unexpected packet format.") and then cycle between unknown and destroyed. Removed the "s" in "https" and made sure there were no white spaces and voila.