Hi Folks,
I am trying to configure entries in the Machine web.config using Set-WebConfiguration / Set-WebConfigurationProperty. Which is working fine, if I am only trying to add an entry.
If I try to change an already existing value, the command adds a completely new "<location>" tag, with the new / updated information. As a result, WAS will not come up on the next iisreset, complaining about a bad configuration.
Repro is straigtforward (on an IIS 8 / Windows 2012 R2 machine)
- create a test web named "TestWeb"
- open powershell
- Import-Module WebAdministration
- Set-WebConfiguration -pspath "MACHINE/WEBROOT" -location "TestWeb" -filter "/system.web/identity" -Value @{ impersonate = "true" }
- Set-WebConfiguration -pspath "MACHINE/WEBROOT" -location "TestWeb" -filter "/system.web/identity" -Value @{ impersonate = "false" }
- Check web.config under c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\, you will see double entries.
Double execution of a command against applicationHost.config works fine and leaves no mess...
set-webconfiguration -pspath "MACHINE/WEBROOT/APPHOST" -location "TestWeb" -filter "/system.webServer/staticContent" -Value @{ enableDocFooter = "true" }
Am I doing something wrong?
Good advice is highly appreciated. :-)
Thanks,
Steffen