Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Digiover/c2ade0f1c9cbedba02235ab65f70ed16 to your computer and use it in GitHub Desktop.
Save Digiover/c2ade0f1c9cbedba02235ab65f70ed16 to your computer and use it in GitHub Desktop.
Add Aspnet.config HighDensityWebHosting performanceScenario
# https://www.saotn.org/aspnet-performance-what-to-keep-in-mind/#highdensitywebhosting
$bitness = @("64", "")
foreach ($bits in $bitness) {
$xml = New-Object xml
$xml.Load("C:\Windows\Microsoft.NET\Framework${bits}\v4.0.30319\Aspnet.config")
# Check whether HighDensityWebHosting performanceScenario is already registered
$nodePerformanceScenario = $xml.SelectSingleNode("configuration/performanceScenario")
# Not registered, let's add HighDensityWebHosting performanceScenario to Aspnet.config
if ($nodePerformanceScenario -eq $null) {
$parentNode = $xml.SelectSingleNode("configuration")
$childNode = $xml.CreateElement("performanceScenario")
$childNode.SetAttribute("value", "HighDensityWebHosting")
$parentNode.AppendChild($childNode)
}
$xml.Save("C:\Windows\Microsoft.NET\Framework${bits}\v4.0.30319\Aspnet.config")
}
@Digiover
Copy link
Author

Don't forget to reset IIS afterwards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment