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:
In order to prevent root settings to be inherited, use inheritInChildApplications attribute in location tag. The location path in the example above is empty. It means that this setting will be applied to the level of the config file and below it.
The InheritInChildApplications property represents the inheritInChildApplications attribute of a location element in a configuration file.
You can use the <clear> element to remove all settings from your application that were defined at a higher level in the configuration file hierarchy.
ApplicationHost. config is the root file of the configuration system when you are using IIS 7 and above. It includes definitions of all sites, applications, virtual directories and application pools, as well as global defaults for the web server settings (similar to machine.
If you can deploy your child application to a separate website (same machine, different port), Application Request Routing may be able to help with this.
The solution is similar to this post. First, install ARR. Then, configure your "child" application on a website that listens on a non-standard port. Next, configure a rewrite rule on the "parent" application's web site that matches the original path to the "child" application. Have this rule forward the request to the newly created website listening on the new port.
I would post an example, but I expect it is fairly straightforward to see how this would work by looking at the post referenced above.
This worked for me.
For those who could not get the location path solution working you might have forgotten to close the location elements tag (if you just edited the web.config in a text editor on the server). Here is an example:
<configuration>
<configSections>
...
</configSections>
<connectionStrings>
...
</connectionStrings>
<location path="." inheritInChildApplications="false">
<system.web>
...
</system.web>
...
</location>
</configuration>
Notice that configSections and connectionStrings should not be in the location element which is probably the reason the OPs attempt did not work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With