如何确定哪个父配置文件正在锁定 web.config 设置?
当我在 IIS 中打开 ASP.NET 站点并尝试打开 .NET 信任级别时,收到一条错误消息:
.NET 信任级别 执行此操作时出错。
详细信息:
文件名:\?\C:\inetpub\wwwroot\myapp\web.config
行号:445
错误:此配置节不能在此路径中使用。当该部分被锁定在父级别时,就会发生这种情况。锁定可以是默认设置 (overrideModeDefault="Deny"),也可以通过位置标记使用 overrideMode="Deny" 或旧的allowOverride="false" 显式设置。
我检查了几个地方,但没有发现任何似乎会锁定该设置的内容。是否有系统的方法来确定该设置的锁定位置?
我使用的是 IIS 7.5 和 .NET 3.5 sp1。
When I open my ASP.NET site in IIS and try to open the .NET Trust Levels, I get an error message:
.NET Trust Levels
There was an error while performing this operation.
Details:
Filename: \?\C:\inetpub\wwwroot\myapp\web.config
Line number: 445
Error: 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".
I've checked a few places, but I haven't found anything that seems like it would be locking that setting. Is there a systematic way of determining where that setting is locked?
I'm using IIS 7.5 and .NET 3.5 sp1.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我还没有弄清楚如何准确确定哪个文件正在锁定任何给定设置,但是如果您选择 IIS 中的最顶层节点(它应该是您的计算机名称),然后打开功能委派,状态栏将显示“配置” :'localhost' root web.config' 或类似的东西。
从这里您可以修改在子级别锁定的设置。
I haven't figured out how to determine exactly which file is locking any given setting, but if you select the very top node in IIS (it should be your machine name) and then open up Feature Delegation, the status bar will read 'Configuration: 'localhost' root web.config' or something similar.
From here you can modify which settings are locked at the child level.
IIS 和 ASP.NET 都支持锁定特定的配置部分。典型的场景是嵌套配置文件 - 例如,您可能在子目录中有一个配置文件,覆盖网站级别配置文件中的某些配置设置(在子级别)。因此,在这种情况下,父级可以决定允许覆盖配置文件中的哪些部分。我相信这个概念从 ASP.NET 2.0 版本开始就存在,而 xml 配置从 IIS 7 开始就出现了,它也支持类似的情况。
请参阅本文了解 ASP.NET 和 本文 IIS 中也一样。请注意,配置文件层次结构从计算机配置和根级别 Web 配置开始 - 因此在不太可能的情况下,您的 Web 配置可能会尝试覆盖这些文件中允许的部分。
Both IIS and ASP.NET supports locking particular configuration sections. Typical scenarios are nested config files - for example, you may have a config file at a child directory overriding some config settings (at child level) from web site level config file. So in such case, parent can decide what sections in config files are allowed to override. I believe the concept exists in ASP.NET since version 2.0 while xml configuration appeared since IIS 7 and it also supports similar cases.
See this article to understand locking config sections in ASP.NET and this article for the same in IIS. Note that configuration file hierarchy as such start from machine config and root level web config - so in unlikely case, your web config may be trying to override allowed sections from these files.