Wednesday, January 14, 2009

MOSS Configuration: How to view the real exception behind the displayed custom error page?

A. Overview For a SharePoint developer, the error message An unexpected error occurred is useless! A developer needs to get details about the error that has occurred, at least the exception's call stack. When installing MOSS, the default configuration is that the Call Stack is deactivated and the custom error pages are turned on. This is completely correct, because this is how you would wish to have it on your production system. Now comes the question: How should I -as a developer- change the default configuration on my development environment? B. Configure your development environment 1. Open the web.config file Path: C:\Inetpub\wwwroot\wss\VirtualDirectories\80\web.config 2. Turn on the call stack - Search for safemode element. - Change CallStack="false" to CallStack="true". 3. Turn off the custom error pages - Search for customerrors element. - Change mode="On" to mode="Off". 4. Enable debugging and batch compilation - Search for compilation element. - Change batch="false" debug="false" to batch="true" debug="true". C. Test your configuration - Browse the page that has previously thrown the "An unexpected error occurred" message. - You should now see the yellow ASP.NET page with the true exception and underlying call stack.

2 comments:

electronic signature pdf said...

You just made something that I thought was so difficult be, truly, so easy! Thanks for the post!

Samar Hossam said...

I am glad to know that the article was of help to you :)