Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you change the allowDefinition section attribute using appcmd in IIS 7?

Tags:

iis

iis-7

appcmd

Is it possible to use appcmd to change the value of allowDefinition? Specifically I'm try to enable changes to the httpCompression module at the application level.

Modifying the applicationHost.config by manually changing the following line:

<section name="httpCompression" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />

To

<section name="httpCompression" allowDefinition="MachineToApplication" overrideModeDefault="Allow" />

allows me to then execute the following appcmd commands:

appcmd set config "website name" /section:httpCompression /noCompressionForProxies:false
appcmd set config "website name" /section:httpCompression /noCompressionForHttp10:false

However I need a solution that does not rely on manually editing the applicationHost.config

like image 750
Edward Wilde Avatar asked Apr 06 '09 13:04

Edward Wilde


1 Answers

My problem was, I had to change anonymousAuthentication from False to True. When I did: appcmd set config websitename /section:anonymousAuthentication /enabled:True

Error I got: Config Error This configuration cannot be used at this path. This happens when the section is locked at the parent level. Locking is either by default(overrideModeDefault="Deny")...

To unlock, do the following: appcmd unlock config /section:? This will list the section you want. Then type:

appcmd unlock config /section:system.webserver/security/authentication/anonymousauthentication

Thats it... :)

like image 69
mark matthews Avatar answered Sep 27 '22 17:09

mark matthews