The webpage cannot be found (404) when accessing a file on Azure App Services Web App
This article has been moved to its new home here: https://benperk.github.io/msdn/2014/2014-09-the-webpage-cannot-be-found-404-when-accessing-a-file-on-azure-websites.html
404 status codes can be a little misleading. I wrote another article here about 404’s here from an on premise IIS perspective, but in principle the information applies. The fact about 404’s is that there are many sub status codes lined to the 404 status code. Most people believe that the 404 means simply that the file doesn’t exist or cannot be found. A closer look at the IIS log or a Failed Request Trace in search of the sub status number can help you find the solution.
Therefore, if you have deployed your code to an Azure Website, you try to access the file and you get a 404 similar to that shown in Figure 1, check the IIS sub status in the IIS log, Detailed Error Messages or via a Failed Request Trace.
I described how to enable Failed Request Tracing on an Azure Website here. If you want the Detailed Error Messages then turn that feature on too.
Figure 1, The webpage cannot be found – Azure App Service Web App
Once enabled the Failed Request trace can be found in the /LogFiles/W3SCV* directory of your Azure App Service Web App. I used FileZilla and I find them in the directory illustrated in Figure 2. Similarly, the IIS logs are in the /LogFiles/http/RawLogs directory and Detailed Error Messages in the /LogFiles/DetailedErrors.
Figure 2, Failed Request Trace log on Azure App Services
Figure 3, 404.3 The webpage cannot be displayed on Azure App Services Web App / Mobile App 404, Failed Request Trace
Figure 4, 404.3 The webpage cannot be displayed on Azure Web App, Detailed Error Message
Notice that the sub status code is 3, (404.3) and also notice that the description of what the sub status code means is described for you. I.e. The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
Figure 5, add a mimeMap to your Azure Web App to allow for downloads of custom file type
Once added the file will be downloaded or rendered in the browser.