Debugging Azure HTTP 500 Errors

By default, Windows Azure Cloud Services Web Role applications, running in Windows Azure or the compute emulator, have the  HTTP Errors <httpErrors> element of the ApplicationHost.config file set to not display detailed error information. What surprised me is that under the compute emulator, IIS-Express doesn’t use the C:Users<user>DocumentsIISExpressconfigapplicationhost.config file, it uses a an ApplicationHost.config file pointed to by the %APPCMD% environment variable.

To get detailed error messages on Azure or the compute emulator, you need to add a startup command to your project with the following lines.

%windir%system32inetsrvAppCmd.exe set config -section:system.webServer/httpErrors -errorMode:Detailed
%APPCMD% set config -section:system.webServer/httpErrors -errorMode:Detailed

The first line enables detailed error messages on Azure. The second line enables them on the compute emulator.

Follow the instructions at How to Block Specific IP Addresses from Accessing a Web Role for setting up the startup command, but replace the ipSecurity line with the lines above.

In addition to blogging, I use Twitter to make quick posts and share links. My Twitter handle is: @RickAndMSFT

Comments (7)
  1. nathan do says:

    Awesome, thank you!!! Just what I needed 😀

  2. dvana says:

    Thanks Rick, very helpful and unblocked my work.

  3. Breaks with 2.0 Configuration Manager says:

    I have a web role that exposes a web service and it works fine.  I then added table storage to write a single entity type.  As soon as I declare a class that inherits from TableEntity, the AppDomain fails to initialize (cannot read configuration file 'trying to read global module configuration data from file '\?C:Users….applicationHost.config', line number '0'.  Worker process startup aborted.)

    IIS Express displays the generic HTTP ERROR 500.

    I tried your approach using the startup.cmd file.  That seemed to work with earlier versions of the Windows.Azure.Configuration assembly.  However, NuGet installs the latest version and this approach no longer seems to work.

  4. Jay says:

    Hey Rick,

    I just cant get my cloud sample app to work. I am working on a windows 8 system and there is a 500 internal server error when i try to run. I am a novice at this stuff but I feel it will be a cakewalk for you. my email id is Just acknowledge if you are free and willing to help

  5. Nathan G says:

    I also have the same issue with the 500 server error on Windows 8.  There HAS to be something with IIS 8 when trying to run an Azure site with the emulator.  I'm going to attempt to install a dual boot of Win7 and see if that produces any positive results.

  6. Vineet says:

    Did the same to my Azure Cloud Service, my expectation was instead of just sending "500 Internal Server Error" it would send me the exact error message and stack trace.

Comments are closed.

Skip to main content