Search code examples
azure-storageazure-storage-emulator

Receiving 404 Response When Attempting to Use the Windows Azure Storage Emulator


The Problem

When I try to work with the storage emulator (v3.4.0.0), I receive the following exception:

System.Net.WebException: The remote server returned an error: (404) Not Found.

Specifically, this happens when I attempt to interact with my CloudBlobContainer instance, which was created via blobClient.GetContainerReference( myContainerName ). In this case, it's happening when I try the following:

var permissions = await container.GetPermissionsAsync();

When I debug the code and watch the container instance before this line is executed, I can see that the object's internals are indeed set to be using the emulator and that all of the appropriate fields/properties are as they should be (using the correct "devstoreaccount1" account name and so on).

Any idea why this is happening? Even better: how can I get my code to see the emulator?

Additional Info

  • The storage emulator is running, I've set it to use my local Sql Server 2012 instance and can confirm that it has created all of the appropriate tables in the database.
  • I tried pinging 127.0.0.1:10000 but get the message "Ping request could not find host 127.0.0.1:10000. Please check the name and try again."
  • I have a local instance of IIS 8.5 running as well, though I guess that's not the problem. Regardless, I'm running my app through IIS, so turning it off isn't an option for me.
  • Running on Windows 8.1

Solution

  • The problem wasn't with the emulator itself, it was with the code. Though I didn't see anything in the docs I read to explain this, it seems that it was necessary to call await container.CreateIfNotExistsAsync() before interacting with the container object.

    I assume this is because it has to physically create the container before applying any settings to it.