Rez's SharePoint Blog Spot

:


Add me to LinkedIn   RSS Feed   Follow me on Twitter
Rez's SharePoint Blog Spot > Posts > Turning off custom errors in _layouts Web.Config for debugging mode in SharePoint 2010
November 06
Turning off custom errors in _layouts Web.Config for debugging mode in SharePoint 2010

As a developer, one of the first things I do after I have setup a web application & site collection is:
Open the web.config (“C:\inetpub\wwwroot\wss\VirtualDirectories\<port>”) and set:

  1. Debug=”true” instead of the default of Debug=”false” (I do a find on “debug” in Visual Studio)
  2. CallStack=”true” instead of the default of CallStack=”false” (I do a find on “callstack” in Visual Studio)
  3. CustomErrors=”Off” instead of the default of CustomErrors=”On” (I do a find on “CustomErrors” in Visual Studio)

I would have expected this to be enough to catch all errors but when I tried to delete a content type that was probably in use, instead of getting the detailed message I was expecting, I ended up getting the infamous message telling me to change the customerrors setting in the web.config so that I can see the details:

Server Error in '/' Application.


Runtime Error

Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed.
Details: To enable the details of this specific error message to be viewable on the local server machine, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "RemoteOnly". To enable the details to be viewable on remote machines, please set "mode" to "Off".

As a refresher to anyone else that is running into this problem, there is another web.config in the _layouts directory (“C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14”) where you need to turn the customErrors to be “Off”:

image

 

Comments

THANK YOU

THANK YOU! This took me an embarrassingly long time to figure out. I'd already edited 5 different .config files.
 on 4/19/2010 11:19 AM

Trackback

 on 5/1/2010 4:42 AM

Re: Turning off custom errors in _layouts Web.Config for debugging mode in SharePoint 2010

Appreciate this blog, saved me a lot of time!!!!!!!!
 on 5/31/2010 7:01 AM

Thanks!

You saved my day!
 on 6/18/2010 3:42 AM

Thanks Rez!

You save me a lot of time! I was very 
obfuscated!

Thanks for this tip!
 on 8/4/2010 7:34 AM

Ugh...

Flippin Finally!
 on 8/16/2010 1:12 PM

Thanks, but which web.config?

I am sorry, but I did a search for web.config under /14/ and found about 20 such files. I changed the CustomErrors to ”Off” in all of them (some didn't have that entry). But am still not seeing the real exception message. I see the message: "one of the properties of the web part has an incorrect format..." Can anyone tell me how to see the real cause for this? TIA
 on 3/18/2011 11:19 AM

For those struggling to find the relevant web.config

For those who are struggling to find the specific web.config file, look in TEMPLATE\LAYOUTS sub directory ("C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS"). I was having the same issue and came across this article (http://msdn.microsoft.com/en-us/library/cc297200(office.12).aspx) which explains more about the visualised _layouts directory. I know the article is about WWS 3.0, however it clearly appears to be relevant in sharepoint 2010, just remember that sharepoint 2010's default Web Server Extensions is \14\ rather than WSS 3.0's \12\.
 on 4/20/2011 2:34 AM

THANK YOU!!!

I no longer need to debug blindly. Much appreciated.
 on 5/26/2011 5:35 PM

Re: Turning off custom errors in _layouts Web.Config for debugging mode in SharePoint 2010

Thanks!
 on 6/22/2011 7:29 AM
1 - 10Next

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title


Name


Your URL


Comments *

SPAMMER Skill Testing Question - What is 2x3? *


This field is to protect me against the barrage of spammers

Attachments