获取错误 "the element 'httpCookies' has been locked in a higher level configuration"

Getting error "the element 'httpCookies' has been locked in a higher level configuration"

当我尝试访问 asp.net mvc 时出现错误“元素 'httpCookies' 已被锁定在更高级别的配置 ” 3 应用。当我在 <system.web> 部分中添加以下行时,会发生这种情况。

<httpCookies httpOnlyCookies="true" requireSSL="true" lockItem="true" />

这发生在 windows 服务器 2003 (IIS 6) 上。 windows 7 & Windows 2008 R2(IIS 7 及更高版本)

上不会出现此错误

我已经检查了 windows 2003 服务器和我的 windows 7 开发机器上的 machine.config 文件,它在两台机器上都包含以下行。

<section name="httpCookies" type="System.Web.Configuration.HttpCookiesSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>

删除属性 lockItem="true" 解决了问题,但我仍然不知道它被锁定在哪个更高级别的配置中。

所以我的行现在如下所示

<httpCookies httpOnlyCookies="true" requireSSL="true" />