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
Have you tried the following link:
http://www.kowitz.net/archive/2007/05/16/stopping-asp-net-web-config-inheritance
I can vouch for this as working as I have done this in the past.
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 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.
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)