Things I Always Do to web.config When Developing and Debugging in SharePoint

First off, if you are debugging a feature receiver or any other type of assembly installed in the GAC, read this post.

Beyond that, I always make the following changes to web.config:

Whenever you see "An unexpected error has occurred," you are looking at a custom error screen. If you want to see the real error, find <customErrors
mode="On" />
and change it to <customErrors
mode="Off" />
to see the standard ASP.Net error page.

I also like to see the call stack and trace information. Find <SafeMode
MaxControls="200"
CallStack="false"
DirectFileDependencies="10"
TotalFileDependencies="50"
AllowPageLevelTrace="false">
and change it to <SafeMode
MaxControls="200"
CallStack="true"
DirectFileDependencies="10"
TotalFileDependencies="50"
AllowPageLevelTrace="true">

Finally, I like to enable generation of debug symbols for just in time compilation in the rare case I need it. Find <compilation
batch="false"
debug="false">
and change it to <compilation
batch="false"
debug="true">
.

None of these configuration choices are appropriate for a production environment, but they all make development much easier. Seeing the actual error and call stack has saved many of the few hairs I have left on my head. "An unexpected error has occurred" is no help to a developer!

Author: Doug Ware