Jas*_*des 3 c# iis inheritance location web-config
我在IIS 7上有一个.NET 4.0应用程序,其中包含一个嵌套的.NET 2.0应用程序。问题在于,嵌套的.NET 2.0应用程序<configSections>在web.config的内部具有system.web.extensions sectionGroup ,而.NET 4.0父应用程序machine.config也包含这些sectionGroups 。这将导致状态码500服务器错误。
从子应用程序web.config中注释掉system.web.extensions sectionGroup可以,但是在我们的设置中不是可选项。
如何防止在子应用程序中继承父web.config?我已经看到了<location path="." inheritInChildApplications="false">在.NET以前的版本中使用过的方法,但是我应该如何包装location元素呢?
Intellisense向我显示“不允许使用InheritedInChildApplications属性”,并且在我放置它的位置似乎无关紧要。
我们将所有不想继承的设置包装在一个空的location元素中:
<location inheritInChildApplications="false">
Run Code Online (Sandbox Code Playgroud)
Intellisense对此有所抱怨,但在生产模式下似乎运行良好。
本文提供了一些很好的附加信息。