c# - web.config inheritInChildApplications ="false"for configSections?

标签 c# iis inheritance web-config location

我在 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/

相关文章:

c# - Access-Control-Allow-Origin 在 IIS 中,但不工作

Javascript 继承 - 使用 .call 方法

c# - 以下缓存项会在 15 分钟后过期吗?

c# - 在 mvc4 中的 Global.asax session 超时时重定向

c# - 使用“图表到系统托盘”最小化表单时出现问题,

将我的 asp.net.core 2.0 应用程序发布到 IIS 时 JavaScript 未运行

javascript - angularjs删除index.html

c++ - 我能以某种方式使用继承吗

c# - 静态方法继承的正确替代方法是什么?

c# - 确保对象不变?