Azure storage emulator - blob creation gives 403 Forbidden message

前端 未结 5 1458
没有蜡笔的小新
没有蜡笔的小新 2020-12-16 16:41

I am attempting to use the Azure Storage Emulator to work with blob storage. I just cannot seem to get it to work and have wasted an entire day trying without success. I kee

5条回答
  •  萌比男神i
    2020-12-16 17:20

    I figured it out!! Or more appropriately I found the answer here: https://stackoverflow.com/a/17500876/1400153

    In the code I posted above, I changed the lines

    // Retrieve storage account from connection string
    CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["EmulatorStorageConnectionString"]);
    

    to

    var connectionString = "UseDevelopmentStorage=true";
    var storageAccount = CloudStorageAccount.Parse(connectionString);
    

    That is literally the only change I made to the code.

    In addition, I right clicked the emulator icon in the windows taskbar > Show storage emulator UI, and I clicked the Reset button. Not sure if this helped, I'm just documenting the two things I did for the next guy who gets stuck on this.

    And now it works...

    Quite frankly I am a little annoyed that the original code did not work. After all, the MSDN article by Microsoft (http://msdn.microsoft.com/en-us/library/windowsazure/hh403989.aspx) clearly states we should use:

    Account name: devstoreaccount1 Account key: Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==

    So why the heck did that not work? That article was updated July 2012 so it is not exactly outdated. So many hours wasted... but at least I can go to sleep now knowing that I finally got something working :)

提交回复
热议问题