Adding a default endpoint
I recently was creating a simple API to do some latency testing and deployed that to Azure app service. When creating an API using the default project template, a controller is created with a route for that controller’s name. In my case, my controller was called LatencyTestController and so all the methods in that controller would reside under /LatencyTest/{route}. During local development, I can see that my endpoints were working fine and Swagger always loaded up when I debugged locally.
I then decided to deploy this to Azure App Service using Visual Studio. The publishing went smoothly, but when I queried the hostname, https://some-app.azurewebsites.net, I kept getting a 404 back. This confused me for quite a while as I completely forgot that I’ve configured my Swagger docs to only run during development. It took more time than I think should have been spent to actually realize that the publishing went well, and I could have just gone to the https://some-app.azurewebsites.net/LatencyTest/MethodA endpoint to get a response properly.
From now on, I think having just a simple OK response on the default home page would be a good practice to do since it’ll help unnecessary troubleshooting.