The intend of this blog is to show the general troubleshooting flow for some common http errors. For this blog, I have chosen http 404 error message and will go through the steps of troubleshooting this error.

When trying to browse to a website hosted in Azure Web Role, I was getting “HTTP Error 404 – File or Directory not found”.
This error could be caused due to many different reasons. I have shown the troubleshooting for one reason.

1. Remote into the Azure Web Role.
2. Go to IIS Manager. (You can get to IIS Manager by typing inetmgr)
3. Go to your site. Click Content View at the bottom.

4. Right click the default.aspx and click browse. See if the webpage comes up. This is to see if IIS is able to load a simple webpage or not.
5. If the above does not work, then put a simple test.html file in the same location as default.aspx and browse to test.html file and see if it works. In Azure Web roles, the contents are generally located at E:\Siteroot\0 (0Role instance ID)
6. In my case, the default.aspx and test.html did not display and I continued to get the 404 error.
7. Rename the Global.asax file to Global.asax.txt and the web.config file to web.config.txt. Check if you can browse to the page after renaming these files.
8. In my case, I was able to browse to the page after renaming the above 2 files. It means, that there was some code in either global.asax or web.config that was preventing execution of my test.html page.
9. I reviewed the code. In global.asax there was a redirect to . However, there was no SSL certificate or endpoint that was configured.
10. To make sure that we could browse to the https site, we created and installed a self-generated SSL certificate using the steps in this article. (See the steps under the section ‘IIS Manager’).
11. After installing the self-signed certificate, we were able to browse to the site using SSL. Renamed the global.asax and web.config to its original names. I could still access my test.html page.
12. The web role was redeployed by adding the SSL certificate and updating the web roles configuration and definition files (csdef and cscfg). You can configure SSL for Azure Web Roles by using the steps in this article. 

This was a very simple error. However, for complicated errors, the following log files can be helpful:
1. IIS Logs
2. Failed Request Tracing (FREB logs)
3. Fiddler/Netmon traces
4. Stack traces from the code
5. Debugging the code using a debugger


The global.asax had redirection code and it was redirecting me to https endpoint. However the https endpoint was not configured and SSL certificate was not defined in the role config and role definition files.


Install a self-signed certificate and tested the site. Redeployed the role after configuring SSL for the site.