A “Server Error in ‘/’ Application” error when browsing your Microsoft Azure Web Site can be a bit tricky to troubleshoot if you don’t know where to look for information.
Here is an example of one of these errors. As you can see, although it does not tell you the root cause of the error, it does tell you how to troubleshoot the error in the Details section. In this post we will cover how to enable CustomErrors as well as some other logging that may help diagnose these issues.
Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
First we will cover the built-in logging in Azure Web Sites and what this shows for this error. If you are not familiar with how to connect to your site using FTP see
As you can see here, the web server logging shows an HTTP status ( sc-status ) of 500 with a sub-status (sc-substatus ) of 0 and a Win32 status (sc-win32–status ) of 0. This information doesn’t get us any closer to understanding the root cause of the error, but I do recommend checking this as in some cases these codes provide additional information. For example the status code might be something like 500 19 where the 19 is a significant piece of information see HTTP 500.19 Errors .
For this case we will focus on the 500 0 0 as shown in the follow IIS log entry ( Note we have removed some of the fields you might normally see.)
date time s-sitename cs-method cs-uri-stem sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken
2014-04-18 19:45:06 RMARRAZUREMGMTAPI GET /servererror.aspx 500 0 0 3847 944
More information on HTTP status codes can be found here: HTTP Status Codes
The Detailed Errors logs are located in the Logfiles/DetailedErrors folder. A log file named ErrorPagexxxxxx.htm is created for each HTTP Status code of 400 or greater.
From the name of the log, logically you might think to look here next , but from an exception perspective, this is not too helpful in this case.
The eventlog.xml file is located in the root of the LogFiles folder of your site. It may contain additional information about why an error occurred. In the example below, we see that there was an unhandled exception of type "NullReferenceException" that occurred in ServerError.aspx.cs in the Page Load method.
In many cases, this information may be all you need to fix the problem, but there might be cases where you need more details.
This is where the customErrors settings may be helpful.
The customErrors section along with the compilation debug settings can help when you need more details about an error and the code where the error originated.
WARNING : This setting will expose your code to external users. Remove these settings after troubleshooting.
To use the customErrors section, add the following to the <system.web> section of the web.config for your site:
Server Error in '/' Application.
Obviously this is a simple example and we know the cause of the exception, but in the real world your next step may require debugging. The following blog post provides information on how to remotely debug your application in Azure Web Sites.
For an example of how to get the root of an exception without using CustomErrors see Using ELMAH in Windows Azure Web Sites .
Custom Errors Element
Troubleshooting Azure Web Sites in Visual Studio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.