Compartilhar via


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

  • Anonymous
    November 27, 2012
    Awesome, thank you!!! Just what I needed :D

  • Anonymous
    December 07, 2012
    Thanks Rick, very helpful and unblocked my work.

  • Anonymous
    May 06, 2013
    The comment has been removed

  • Anonymous
    February 20, 2014
    The comment has been removed

  • Anonymous
    April 13, 2014
    I have same issue. allabtcloud.blogspot.com

  • Anonymous
    July 18, 2014
    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.

  • Anonymous
    August 01, 2015
    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.