Monday 23 April 2018

Configure the deployment retail in machine.config

Configure the deployment retail in machine.config


Continuing my post about the web.config debug flag, you could also set the deployment retail attribute in the machine.config to achieve some of the same effects.
When the retail attribute is set to true, 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.
Note that you should continue to set the debug attribute to false in application’s Web.config files that are deployed to the server. The debug setting disables request execution timeout, and this is not overridden by the retail setting.

For the purpose of setting the deployment retail attribute in all the machine.config files (for all the .NET Frameworks installed) on several remote machines, I wrote two PowerShell functions:
Get-DeploymentRetailMode and Set-DeploymentRetailMode. These can be run in several ways, for example:
Get-DeploymentRetailMode
 
Set-DeploymentRetailMode -Retail False
 
'Web01', 'Web02' | Get-DeploymentRetailMode
 
Set-DeploymentRetailMode -ComputerName 'Web01', 'Web02' -Retail $true
 
'Web01', 'Web02' | Set-DeploymentRetailMode -Retail $false
 
These function will be available in your PowerShell scope, after you "dot source" the script:
. C:\myScripts\Configure-DeploymentRetail.ps1 
or inside the script file of course.

The functions are available in the Configure-DeploymentRetail.ps1 script, posted in the TechNet script gallery.

For more details on the deployment retail attribute, see: https://msdn.microsoft.com/en-us/library/ms228298(VS.80).aspx
For more details on the debug mode in ASP.NET applications, see https://support.microsoft.com/en-us/kb/2580348

HTH,
\Martin.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.