One handy deployment tip is to set IIS retail mode to true in the Machine.config:
<system.web>
<deployment retail=”true”/>
</system.web>
This will disable tracing output & debug mode and also force custom errors to On.
Note if you are trying to debug a problem on webserver using CustomErrors set to remoteonly and it is not working this setting in the Machine.config may be the issue.
This is a simple change that may prevent a serious leakage of data through error messages etc.