2

如果我通过 IIS UI,我可以选择一个站点,在 IIS 下打开身份验证,然后编辑匿名身份验证以使用应用程序池标识。但是,当我尝试使用 appcmd 做同样的事情时遇到了一个问题:

appcmd set config "SiteName" /section:anonymousAuthentication /userName:

当我运行它时,我得到以下信息:

ERROR ( message:Can not set attribute "userName" to value "".. Reason: This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".
. )

现在,我显然可以通过 UI 做到这一点,所以我的 appcmd 命令必须尝试做一些不同于我通过 UI 完成的事情。问题是,如何使用 appcmd 复制我的 UI 操作?

4

1 回答 1

4

我刚刚遇到了同样的问题。如其所述,您尝试更新的部分已锁定,因此只需在您之前运行此命令即可解锁匿名身份验证配置部分:

appcmd unlock config -section:system.webServer/security/authentication/anonymousAuthentication -commitpath:apphost

您的配置更改现在应该成功处理!

于 2015-01-19T15:07:52.107 回答