This SharePoint 2013 tutorial explains, how to enable custom error web.config in SharePoint 2013/2016? This tutorial, I would like to discuss the issue while rendering SharePoint site “Server Error / Application”. We will discuss how we can enable custom error in SharePoint farm solution.
When I was trying to render my SharePoint site I was getting the below error message.
Enable custom error web.config SharePoint 2013
The above error message is soo generic and we don’t understand what has happened exactly. To understand the exact issue we need to enable custom errors for this SharePoint web application.
Follow the below steps to understand the error description:
- Log on to SharePoint server with FARM Administrator account
- Open IIS with through run prompt with the command “inetmgr”
- Identify the web application you want to enable error logging
- Click on Explore on the right panel
- Open the Web.config file
- Identify “” tag
- Change the mode value to “on”
- Restart IIS
Now when you open the site you can see the detailed issue in the browser.
Modify web.config for debugging support in SharePoint
Now we will see, what are the modifications needed in web.config file to enable debugging support in SharePoint custom development.
Whenever you start debugging a SharePoint visual studio project, it ask you in a dialog box that, Debugging is not enabled. And it gives two options whether you want to enable debugging (which automatically do changes in web.config file) or you want to run without debugging support as shown in the figure below:
If you choose the first option the it will do below modifications in the web.config file:
- Set CallStack=”true” in SafeMode attribute.
- Set customErrors mode=”Off” in the system.web section.
- compilation debug=”true” in the system.web section.
So the changed part of the web.config file should now look like below:
<configuration> <SharePoint> <SafeMode CallStack="true" /> </SharePoint> <system.web> <customErrors mode="Off" /> <compilation debug="true" /> </system.web> </configuration>
Remember this changes should not be there in the production server. There debugging option should be disabled. So the web.config for production server should look like below:
<configuration> <SharePoint> <SafeMode CallStack="false" /> </SharePoint> <system.web> <customErrors mode="On" /> <compilation debug="false" /> </system.web> </configuration>
Visual studio automatically update the web.config to support debugging but it did not reverse it back. So for production we have to do manually like above.
You may like following SharePoint 2013 tutorials:
- User Information List in SharePoint 2016/2013/2010
- Update User Email ID using PowerShell in SharePoint 2013/2016
- Extend web application in SharePoint 2013 (using PowerShell and Central Administration)
- SharePoint 2013 farm solution stuck retracting
- Documents are not showing up in Search Results in SharePoint 2013
- Alternate Access Mapping in SharePoint 2016
- Delete Hidden Web Application in SharePoint 2013 using PowerShell
- Unable to Upload Large Files to SharePoint 2013
- SSRS version conflict issue in SharePoint2013
- Update People Picker Group field using Rest API and jQuery in SharePoint 2013/2016
- PSConfig Microsoft.SharePoint.Administration.SPUpdatedConcurrencyException Issue in SharePoint
- Make Title field read-only in SharePoint list edit form using JSLink
- SharePoint 2013 alerts are not working
This SharePoint 2013 tutorial explains, how to enable custom error web.config in SharePoint 2013 or in SharePoint 2016.
I am Krishna.Vandanapu a SharePoint architect working in IT from last 13+ years, I worked in SharePoint 2007, 2010, 2013, 2016 and Office 365. I have extensive hands on experience in customizing SharePoint sites from end to end. Expertise in SharePoint migration tools like Sharegate, Doc Ave and Metalogix. Migrated SharePoint sites from SharePoint 2007 to 2010 and 2010 to 2013 several times seamlessly. Implementing CSOM with Microsoft best practices. Spent quality time in configuring SharePoint application services like User Profile, Search, Managed Meta data services etc. Now exploring SharePoint Framework and SharePoint 2019
Download SharePoint Online Tutorial PDF FREE!
Get update on Webinars, video tutorials, training courses etc.