Turning on Detailed Error Messages in SharePoint 2007 1

This post is not really that novel but I link to other peoples blogs for this topic constantly, so I might as well make my own post with this information:

When customizing SharePoint its fairly easy to make an error or omit something… if and when you do, an out-of-the-box SharePoint site will simply respond by displaying a page that says “An unexpected error has occurred”. I don’t need to tell anyone that this is less than helpful when you are trying to debug something (though it makes total sense for a default setting from a security and usability point of view). In order to see detailed error messages you need to make some very simple changes to the web.config file located on the server that hosts your SharePoint site. Here are the steps:

  1. Login to the Windows server that hosts your SharePoint site and navigate to the website root folder (typically a subdirectory of C:\Inetpub\wwwroot\wss\VirtualDirectories).
  2. Edit the file named “web.config” with Notepad or any other text editor.
  3. Find the line of code that contains the word “CallStack”, which should look like “” and change both the CallStack and AllowPageLevelTrace settings from “false” to “true”.
  4. Next find the line of code that contains the word “Errors”, you should see a line that looks like “”. Change the mode from “On” to “Off”.
  5. Save and close the file.

Warning: this will cause IIS to restart the web application that your SharePoint site lives in (so don’t just do it randomly on a site that other people are using… also it’s probably not a great idea to turn on detailed errors on a production machine for any long period of time).

Once you have made these changes, the error message should now provide a lot more helpful information such as “Cannot find ContentPlaceHolder ‘PlaceHolderPageImage’ in the master page ‘/_catalogs/masterpage/custom.master’, verify content control’s ContentPlaceHolderID attribute in the content page”.

One comment on “Turning on Detailed Error Messages in SharePoint 2007

  1. Reply Christine Jan 29,2010 4:14 pm

    Thanks you, this was very helpful in getting a better error message.

Leave a Reply