SharePoint Debugging web.config Modifications


OK, this is nothing new, but like Eric White, I want to make sure I can always find these settings.  Plus I hope this can be helpful to others looking for them.

Three Settings

  1. <SafeMode CallStack=”true” (search for “calls”)
  2. <customErrors mode=”Off” (search for “custome”)
  3. <compilation debug=”true” (search for “debug=”)

If you are writing custom components in SharePoint, or you are a system administrator you may see the following:

web_config_modsError
An unexpected error has occurred.
Web Parts Maintenance Page: If you have permission, you can use this page to temporarily close Web Parts or remove personal settings. For more information, contact your site administrator.
Troubleshoot issues with Microsoft SharePoint Foundation.
Correlation ID: (some correlation ID in the format 12345678-90ab-cdef-1234-567890abcdef made up of hexadecimal characters).

At this point, you can search the ULS for the corelation ID (my favorite tool for that is the ULS Viewer) or you can edit the web.config so you can see the error displayed by ASP.NET.

The easiest way to edit the web.config is to launch InetMgr.exe (Internet Information Services (IIS) Manager), find the IIS site that matches the SharePoint Web Application zone you need to debug, right-click, and choose Explore.

web_config_mods2Once you are in the Windows Explorer folder for the root of the Web App you need to modify (it will probably be something like C:\inetpub\wwwroot\wss\VirtualDirectories\<webappname>), then look for web.config.  If you are not experienced at editing XML, I recommend you make a backup of the original, in case you mess it up and can’t fix it, that way you can roll back to the original.

Now open web.config with Notepad (or favorite text editor, mine is Notepad++)

Search for “calls” that will locate CallStack=”false”. If for some reason your web.config has multiple matches for calls then search for “callstack”. Change false to true.  Search for custome (there are many matches for custom, but only one customerrors, so custome usually does it. Change On to Off (remember XML is case sensitive, so honor the casing of the previous value).  Finally, search for debug= (you need the equals sign because there are many reference to the word debug in web.config.  Change false to true.  Now save it.

Refresh the browser window that displayed the original error and you should see something like this:

web_config_mods3

With this debug information, you will be on your way to finding out where the exception occurred and closer to fixing it.  Happy debugging!

For more information:

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s