See actual SharePoint error exception modify web.config

SharePoint errors and exceptions

Whenever something goes wrong in SharePoint, you are greeted with a non-useful error message like below -

SharePoint 2007 - An unexpected error has occurred.

SharePoint 2010 - An unexpected error has occurred.

SharePoint 2013 - Sorry, something went wrong.

Display meaningful and developer-friendly error

Make the following changes to the corresponding web.config file of your site by following the below steps.

  1. Navigate to the virtual directory of your web application (usually located at C:\inetpub\wwwroot\wss\VirtualDirectories). For example, if your site is hosted on port 80 then open the folder 80.
  2. Locate web.config file and create a backup (backup is very important, just in case something goes wrong)
  3. Open the web.config in any editor which you are comfortable (Notepad, Notepad++, WordPad, EditPlus, Word, etc). Visual Studio will be my preferred editor.
  4. Locate the tag . There is an attribute CallStack which is set to False by default. Set this attribute to True. This will allow SharePoint to enable stack trace and display the actual details of error/exception.
  5. Locate the tag . There is an attribute mode which is set to On by default. Set this attribute to Off. This will enable custom errors instead of showing user-friendly messages.
  6. Refresh the page with the error and now you should see more details that are useful to the developer for troubleshooting.
  7. This is how your changes should look.
<SafeMode CallStack="true" ............... >

<customErrors mode="Off" />

⚠️ Important: This is recommended only in Development environments and you should not fiddle with the web.config in production environments. The purpose of enabling and custom errors and complete stack trace is only for easier troubleshooting and developers are recommended to revert the changes once development is completed.

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap