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