我在 IIS 7 上有一个 .NET 4.0 应用程序,其中包含一个嵌套的 .NET 2.0 应用程序。问题是嵌套的 .NET 2.0 应用程序在 <configSections>
中有 system.web.extensions sectionGroup。 web.config 和 .NET 4.0 父应用程序 machine.config 也包含这些部分组。这会导致状态代码 500 服务器错误。
从子应用程序 web.config 中注释掉 system.web.extensions sectionGroup 是可行的,但不是我们设置的选项。
如何防止在子应用程序中继承父 web.config?我看过 <location path="." inheritInChildApplications="false">
在以前的 .NET 版本中使用过,但我如何包装位置元素?
Intellisense 向我显示“不允许使用 inheritInChildApplications 属性”,而且我把它放在哪里似乎并不重要。
最佳答案
我们将所有不想继承的设置包装在一个空的 location 元素中:
<location inheritInChildApplications="false">
Intellisense 提示它,但它似乎在生产模式下运行得很好。
this article 中有一些很好的附加信息.
关于c# - web.config inheritInChildApplications ="false"for configSections?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11802284/