Quantcast
Channel: Configuration & Scripting
Viewing all articles
Browse latest Browse all 780

Set-WebConfiguration on MACHINE/WEBROOT level creates double entries

$
0
0

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)

  1. create a test web named "TestWeb"
  2. open powershell
    1. Import-Module WebAdministration
    2. Set-WebConfiguration -pspath "MACHINE/WEBROOT" -location "TestWeb" -filter "/system.web/identity" -Value @{ impersonate = "true" }
    3. Set-WebConfiguration -pspath "MACHINE/WEBROOT" -location "TestWeb" -filter "/system.web/identity" -Value @{ impersonate = "false" }
  3. 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


Viewing all articles
Browse latest Browse all 780

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>