This question was originally targeted at the Azure Service Fabric because that is my deployment model. But it has become clear to me that this is a WCF issue so I am rewording it to better suit that. The original text of the question is highlighted below in yellow.
I've created a self-hosted WCF app that exposes a simple Restful WebApi over port 80 and 443. All my endpoints work as expected, same as when I had the very same code hosted in IIS. The problem is that when I perform negative testing by trying to access a path that does not exist I get HTTP 503 errors, not HTTP 404 as I'd expect.
It has been pointed out to me that this likely has something to do with http.sys since that is what's fielding the incoming requests. So how do I work around this? Surely this must be a common issue for self-hosted WCF apps. Is there a way to get http.sys, or whatever component is between my app and the user, to returning a more meaningful error like a 404?
Any thoughts on why this is and how I might fix it?
I've setup a stateless service WebApi that is publicly exposed from my SF cluster via port 80. The api is working well, but I've noticed that if I perform an HTTP request on any invalid path, such as "GET http://mycluster.westus.cloudapp.azure.com/thisisinvalid" that I am getting an HTTP 503 status back. I would expect a 404, as a 503 is misleading and will be confusing to my customers. My stateless service is a WCF based WebApi by the way.