Enable Debugging and set custom errors off in SharePoint

 

Posting this snippet so that I can always find it when I need it.

To debug a SharePoint solution you need to set following values in web.config

  • 1. Turn on the call stack (CallStack="true")

  • 2. Disable custom errors (<customErrors mode="Off" />)

  • 3. Enable debugging (<compilation debug="true">)

Go to \\Inetpub\wwwroot\wss\VirtualDirectories\ Port_Number

This web.config defines configuration settings for a SharePoint Web application.

Now you might still get custom error message on your application page and not the real exception. 

This happens because there are web.config at other places too in SharePoint.  So for configuration of layouts directory where an application page resides, you need to change the web.config at following location too.

%ProgramFiles%\Common Files\Microsoft Shared\web server extensions\15\TEMPLATE\LAYOUTS — The web.config file that defines configuration settings for the /_layouts virtual directory

Additonal Notes from msdn.

Web.config files are contained in the following folders within the file system:

  • \\Inetpub\wwwroot\wss\VirtualDirectories\ Port_Number — The web.config file that defines configuration settings for a SharePoint content Web application.

  • \\Inetpub\wwwroot\wss\VirtualDirectories\ Port_Number_of_Central_Administration — The web.config file that defines configuration settings for the SharePoint Central Administration application.

  • %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\15\CONFIG — The web.config file and other .config files that together define configuration settings for extending other Web applications.

  • %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\15\ISAPI — The web.config file that defines configuration settings for the /_vti_bin virtual directory.

  • %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\15\TEMPLATE\LAYOUTS — The web.config file that defines configuration settings for the /_layouts virtual directory

 

Happy SharePointing!!!

Technorati Tags: SharePoint 2013,Configuration,Useful snippet,Debugging,web.config in SharePoint,Custom errors Off

Comments

  • Anonymous
    July 19, 2016
    Found the post helpful. Thank You for sharing.