本文介绍了如何在 IIS 7 中使用 appcmd 更改 allowDefinition 部分属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用 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 解锁配置/section:system.webserver/security/authentication/anonymousauthentication

就是这样... :)

这篇关于如何在 IIS 7 中使用 appcmd 更改 allowDefinition 部分属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-10 18:38