Why would I get a "503 - Service Unavailable" error when the service is available?

B. Clay Shannon picture B. Clay Shannon · Sep 12, 2014 · Viewed 7k times · Source

According to this, a 503 error is "503 Service Unavailable The server is currently unavailable (because it is overloaded or down for maintenance). Generally, this is a temporary state."

Yet that doesn't seem to be the case for me. I have a Web API server app running which exposes a REST method. I can successfully call it from Fiddler Composer (it receives a file and saves it to disk), but ONLY if I use "localhost" (the IP Address doesn't work, nor does the Hostname).

When trying to call the method from my Windows CE / Compact Framework handheld device (which cannot use "localhost" as that would be narcissistic and foolhardy), I can get either error 400 - Bad Request from the server, or the 503 error, depending on whether I use the IP address or the Hostname of the PC on which the Web API app is running.

With my applicationhost.config file like this:

<site name="HHS.Web" id="2">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\project\git\CStore\HHS.Web" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:21608:localhost" />
        <binding protocol="http" bindingInformation="*:21608:192.168.125.50" />
    </bindings>
</site>

...I get err 400 - Bad Request when I try to call a REST method on HHS.WEB from a handheld client using this URL: http://192.168.125.50:21608/api/inventory/sendXML/duckbilled/platypus/bla

With applicationhost.config file like this:

<site name="HHS.Web" id="2">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\project\git\CStore\HHS.Web" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:21608:localhost" />
        <binding protocol="http" bindingInformation="*:21608:shannon2" />
    </bindings>
</site>

...and this uri, using my hostname: http://shannon2:21608/api/inventory/sendXML/duckbilled/platypus/bla

...I get the "503" error. The server is running, as can be seen when I change the entry in applicationhost.config and the URL that I call; so why is it telling me it's not available?

UPDATE

I was hoping I had had a brainstorm, and that using "PPP_PEER" to designate the PC would do the trick, and so I changed the URL the app on the handheld device is calling from this:

http://192.168.125.50:21608/api/inventory/sendXML/duckbilled/platypus/bla

...to this:

http://PPP_PEER:21608/api/inventory/sendXML/duckbilled/platypus/bla

...as that seems to be how the handheld must reference the PC, but that just takes me back to the "400 - Bad Request" err msg (and the breakpoint in the server app is still not hit). If using "PPP_PEER" is the right idea, what else do I need to make it work?

UPDATE 2

The crux of the biscuit was adding at the command prompt either this:

netsh http add urlacl url=http://shannon2:80/ user=everyone

...or this:

netsh http add urlacl url=http://shannon2:8080/ user=everyone

See Update 5 here for more details

Answer