Disable Custom Error Mode In SharePoint 2010


A generic application error on the server or an Unxpected Error may be the error you are getting most of the time. If so then the current custom error settings for the application prevent the details of the application error from being viewed. As I work in SharePoint 2007 the first things I do are listed below. First you have to open the web.confing file of the application C:\inetpub\wwwroot\wss\VirtualDirectories\<port>.
 

  1. Debug="true" instead of the default of Debug="false"
  2. CallStack="true" instead of the default of CallStack="false"
  3. CustomErrors="Off" instead of the default of CustomErrors="On"

I have done this but still I got the custom error message like below.

Server Error in '/' Application.


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.
Details: To enable the details of this specific error message to be viewable on the local server machine, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "RemoteOnly". To enable the details to be viewable on remote machines, please set "mode" to "Off".

Then I found out SharePoint 2010 has a second web.config file located at the
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\web.config
That second web.config file contains the customErrors section that needs to be set to off. 
Central Administration has a second web.config file too if you need to see error descriptions there:

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\ADMIN\web.config

From customErrors section set the value to off.

These settings helped me to get the exact error message