I am trying to add <proxy enabled="true" />
element under system.webServer
section.
Add-WebConfigurationProperty -Filter '/system.webServer/proxy' -Name . -Value @{ enabled="true" }
Above command does nothing.
Add-WebConfigurationProperty -Filter '/system.webServer' -Name 'proxy' -Value @{ enabled="true" }
Above command throws error: Property proxy is not found on system.webServer
Add-WebConfiguration -Filter '/system.webServer/proxy' -Value @{ enabled="true" }
Also does nothing.
Set-WebConfigurationProperty -Filter '/system.webServer/proxy' -Name 'enabled' -Value 'true'
Shows warning: Target configuration object '/system.webServer/proxy is not found at path 'MACHINE/WEBROOT/APPHOST'.
I find these commands very counterintuitive. What is the right way to add new element?
EDIT:
I was testing these commands on Windows 2019 Core with default IIS 10.0
I have Windows Server 2012 R2 with IIS 8.5
I can setup proxy on Win2012 with command appcmd set config -section:system.webServer/proxy /enabled:"true" /commit:apphost
, but the same command doesn't work on Win2019. It shows error Unknown config section "system.webServer/proxy".
So, this setting may be not valid for IIS 10.0
CodePudding user response:
First you need to make sure ARR has install like Lex Li said.
Then try this powershell command, it can work well in my server 2019.
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.webServer/proxy" -name "enabled" -value "True"