Azure Bob storage Exception Microsoft.WindowsAzure.Storage.CloudStorageAccount

I am getting below exception while accessing blob storage while parsing the connection string. Error:

The type initializer for 'Microsoft.WindowsAzure.Storage.CloudStorageAccount' threw an exception.

No solution found why is this happening?


  • I had this same problem, and the fix for me was to add the Microsoft.WindowsAzure.Storage package to all of the projects then cleaning and rebuilding.

  • puddlepuddle USMember

    In case anyone else runs into this issue, my problem was that I accidentally deleted the package reference and added it manually. The solution is to simply delete the Microsoft.WindowsAzure.Storage package altogether, close the project, then re-install it.

  • Amar_BaitAmar_Bait DZMember ✭✭✭✭✭
    edited April 2017

    Hope you guys are thinking about the security of your apps... including connection strings client side is a... very bad idea... especially for a paying service like Azure

  • DanBeaulieuDanBeaulieu USMember ✭✭
    edited August 2017

    Had the same issue, the problem for me was I was only passing my account key into CloudStorageAccount.Parse(). The argument should look something like this:
    var account = CloudStorageAccount.Parse($"DefaultEndpointsProtocol=https;AccountName={Constants.AzureAccountName};AccountKey={Constants.AzureBlobStorageKey}");

Sign In or Register to comment.