Alex Rivera | Logout

Stop inheriting web.config from parent ASP.NET application in IIS 7.5

Asked 2011-05-31T06:10:41.717
11

We have deployed an ASP.NET Website (App 1) in IIS 7.5. Then under that application create another ASP.NET application (App 2). But in App 2, I don't want to inherit the web.config from App 1.

If I try to do the following in App 1's, web.config:

<location path="." inheritInChildApplications="false"> 
    <configSections> 

    <!-- etc -->

    </configSections>
</location>

it reports the error:

Config Error The configuration section 'configSections' cannot be read because it is missing a section declaration

If I try to do:

<remove name = "system.web.extensions" /> 

it still reports the same error:

Edit
Report

1 Answer

0

You can't wrap the whole <configSections> configuration element in a <location path="." inheritInChildApplications="false">. This isn't supported in ASP.NET (yet).

From the documentation:

SectionInformation.InheritInChildApplications Property

The InheritInChildApplications property applies only to location-specific configuration settings.

Also:

Gets or sets a value that indicates whether the settings that are specified in the associated configuration section are inherited by applications that reside in a subdirectory of the relevant application.

<configSection> elements are special and are not configuration settings as such. They are used to define the handlers for configuration settings.

If you need to remove a conflicting configuration <section> from a child application you can do this in the child application's web.config file with the <remove> element:

remove Element for configSections (General Settings Schema)

answered 2011-06-01T11:29:22.437

Your Answer