Windows Azure Storage Emulator returning 503 - Service Unavailable

Today's post is the result of about four hours of tracking down a tricky problem, so hopefully this will help others.

My problem began when I was testing an Azure project with the storage emulator. The code that was supposed to work with the blob service would fail any request with a "503 - Service Unavailable" error. All other services seemed to be working correctly.

Looking at the headers in the Response object of the exception, I could see that this was produced by the HTTP Server library by the telling Server header (Microsoft-HTTPAPI/2.0 in my case). So this wasn't really a problem with the storage emulator - something was failing earlier on.

Looking at the error log at %SystemRoot%\System32\LogFiles\HTTPERR\httperr1.log in an Administrator command prompt, there almost no details, so I had to look around more to figure out what was wrong.

Turns out that some time ago I had configure port 10000 on my machine to self-host WCF services according to the instructions on Configuring HTTP and HTTPS, using https://+:10000. The storage emulator currently sets itself up as https://127.0.0.1:10000/. According to the precedence rules, "+" trumps an explicit host name, so that was routed to first, but there was no service registered for "+" at the moment, so http.sys was correctly returning 503 - Service Unavailable.

To verify, I can simply run this command from an Aministrator command prompt:

C:\Windows\system32>netsh http show urlacl

URL Reservations:
-----------------

    Reserved URL : https://*:2869/
        User: NT AUTHORITY\LOCAL SERVICE
            Listen: Yes
            Delegate: No
            SDDL: D:(A;;GX;;;LS)

    Reserved URL : https://+:80/Temporary_Listen_Addresses/
        User: \Everyone
            Listen: Yes
            Delegate: No
            SDDL: D:(A;;GX;;;WD)

... (an entry for https://+:10000/ was among these!) ...

The first was a simple one-liner, again from an Administrator command prompt, to delete that bit of configuration I didn't need anymore, and the storage server is up and running again.

netsh http delete urlacl url=https://+:10000/

Enjoy!