Wednesday, July 3, 2013

Impress your colleagues with your knowledge about... <deployment retail=”true”/>

Sometimes when working with C.NETyou discover some hidden gems. Some of them very useful, other ones a little bit harder to find a good way to benefit from their functionality. One of those hidden gems that I discovered some days ago is the retail attribute on the deployment element in your machine.config.

When moving your ASP.NET applications to a production environment, you will most likely want to set the compilation debug attribute in web.config to false, as having debug set to true has some downsides:

  • Compilation takes longer as batch optimizations are disabled
  • Scripts and images from WebResources.axd will not be cached on the client
  • Larger memory footprint
  • Code will execute slower because of enabled debug paths
  • Request execution timeout is disabled

If you set the retail option to true in your web.config, ASP.NET disables trace output, disables debug capabilities, and disables detailed system-generated error messages for remote users. For applications that have a customErrors element in the application Web.config file, the mode attribute is forced to On. These settings override any settings that are made in application Web.config files.

Remark: This value can only be set at the machine level, not at the application level.

No comments: