web.config inheritInChildApplications="false" for configSections?

19,237

Solution 1

The solution in this case was to modify my test environment to avoid the configSection conflicts. There doesn't appear to be a real solution for this conflict. See here: How to stop inheritance of configSections in Web Config

Solution 2

We wrap all of the settings that we don't want inherited in an empty location element:

<location inheritInChildApplications="false">

Intellisense complains about it, but it seems to run just fine in production mode.

There is some good additional information in this article.

Share:
19,237
Jason Eades
Author by

Jason Eades

Updated on June 04, 2022

Comments

  • Jason Eades
    Jason Eades about 2 years

    I have a .NET 4.0 application on IIS 7 that contains a nested .NET 2.0 application. The problem is that the the nested .NET 2.0 application has the system.web.extensions sectionGroup within the <configSections> of the web.config and the .NET 4.0 parent applications machine.config contains those sectionsGroups as well. This causes status code 500 server error.

    Commenting out the system.web.extensions sectionGroup from the child applications web.config works but isn't an option with our setup.

    How can I prevent inheriting the parent web.config in the child application? I've seen that <location path="." inheritInChildApplications="false"> was used in previous .NET versions but what do I wrap the location element around?

    Intellisense shows me that "The inheritInChildApplications attribute is not allowed" and it doesn't appear to matter where I put it.