问题描述
是否可以使用appcmd更改allowDefinition的值?具体来说,我尝试在应用程序级别启用对httpCompression模块的更改。
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.
通过手动更改以下行来修改applicationHost.config:
Modifying the applicationHost.config by manually changing the following line:
<section name="httpCompression" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
到
<section name="httpCompression" allowDefinition="MachineToApplication" overrideModeDefault="Allow" />
允许我执行以下appcmd命令:
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
但是我需要一个不依赖于手动编辑applicationHost.config的解决方案
However I need a solution that does not rely on manually editing the applicationHost.config
推荐答案
我的问题是,我必须将anonymousAuthentication从False更改为True。当我这样做时:
appcmd set config websitename / section:anonymousAuthentication / enabled:True
My problem was, I had to change anonymousAuthentication from False to True. When I did:appcmd set config websitename /section:anonymousAuthentication /enabled:True
我得到的错误:
配置错误此配置不能在此路径中使用。当该部分在父级别锁定时会发生这种情况。默认锁定(overrideModeDefault =Deny)...
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")...
要解锁,请执行以下操作:
appcmd unlock config / section: ?这将列出您想要的部分。然后输入:
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... :)
这篇关于如何在IIS 7中使用appcmd更改allowDefinition部分属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!