Ultimate Debugging Enabler for SharePoint
Synopsys
On every new environment we often need to enabling custom errors, debug mode and other settings that will make your development environment spit-up all the exception in a human readable way.
What we don't usually we know is that, not only can be disable CustomErrors for SharePoint sites - just as we would for any .NET application - but there are also other things that we may need to take into considering in order to end up seeing something different than this:
Solution
Although we can see many different methods describing what, where and how to prepare an environment for debugging, the truth is that this procedure is not easy or straight-forward, and there doesn't seem to be a single place with all this information.
- different methods (CallStack, Debug, CustomErrors, AllowPageLevelTrace, Trace)
- different locations (IIS web.config, Template\Layouts, Template\Admin)
My proposal is to run a simple PowerShell script that will easily enable all the debugging attributes on all the necessary web.config locations, without harming the configuration files, and being able to revert the process to an original state.
As an added perk, a backup of the configuration file is made on every script execution (using the same format that regular backups use).
In case the debug mode was not changed, there will be no changes, to avoid having the pool recycle unnecessarily.
Script
Sources
http://blogs.msdn.com/b/voyage/archive/2014/09/02/enable-debugging-and-set-custom-errors-off-in-sharepoint.aspx
https://msdn.microsoft.com/en-us/library/ee231550.aspx
https://hughajwood.wordpress.com/2012/09/24/local-debugging-in-sharepoint/
http://blogs.prexens.com/Lists/Posts/Post.aspx?List=7a299699-f8da-4559-920c-bda481608691&ID=8
https://msdn.microsoft.com/en-us/library/0x5wc973%28v=vs.140%29.aspx
On every new environment we often need to enabling custom errors, debug mode and other settings that will make your development environment spit-up all the exception in a human readable way.
What we don't usually we know is that, not only can be disable CustomErrors for SharePoint sites - just as we would for any .NET application - but there are also other things that we may need to take into considering in order to end up seeing something different than this:
Solution
Although we can see many different methods describing what, where and how to prepare an environment for debugging, the truth is that this procedure is not easy or straight-forward, and there doesn't seem to be a single place with all this information.
- different methods (CallStack, Debug, CustomErrors, AllowPageLevelTrace, Trace)
- different locations (IIS web.config, Template\Layouts, Template\Admin)
My proposal is to run a simple PowerShell script that will easily enable all the debugging attributes on all the necessary web.config locations, without harming the configuration files, and being able to revert the process to an original state.
As an added perk, a backup of the configuration file is made on every script execution (using the same format that regular backups use).
In case the debug mode was not changed, there will be no changes, to avoid having the pool recycle unnecessarily.
Script
Sources
http://blogs.msdn.com/b/voyage/archive/2014/09/02/enable-debugging-and-set-custom-errors-off-in-sharepoint.aspx
https://msdn.microsoft.com/en-us/library/ee231550.aspx
https://hughajwood.wordpress.com/2012/09/24/local-debugging-in-sharepoint/
http://blogs.prexens.com/Lists/Posts/Post.aspx?List=7a299699-f8da-4559-920c-bda481608691&ID=8
https://msdn.microsoft.com/en-us/library/0x5wc973%28v=vs.140%29.aspx
Comments
Post a Comment