Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent inheriting parent web.config to child Application on IIS 7.5

On IIS 7.5 I have parent site using parentAppPool and SubApplication using childAppPool.

Parent site load all fine, but when I access subApplication as http://parentSite.com/SubApplication it is expecting DLLs from Parent site bin

In order to prevent the web.config inheritance, I tried wrapping <system.web> with <location path="SubApplication" inheritInChildApplications="false"> and <location path="." inheritInChildApplications="false"> this is breaking the parent site to work.

Then I tried adding enableConfigurationOverride="false" attribute to SubApplicationPool in applicationHost.config that also didn't work

Any help would be appreciated.

high level skeleton of web.config enter image description here

When I try this, I get Telerik error on parent site, but child site works!

'~/Telerik.Web.UI.WebResource.axd' is missing in web.config. RadScriptManager requires a HttpHandler registration in web.config. Please, use the control Smart Tag to add the handler automatically, or see the help for more information: Controls > RadScriptManager

like image 499
HaBo Avatar asked Apr 14 '16 12:04

HaBo


People also ask

How do I stop inheriting parent web config?

Ignoring the parent web config settings The Web. Config settings are inherited automatically from the root application, and it may raise a problem to run the Dashboard Service at IIS. To overcome this, use the location tag with path value as '. ' and inheritInChildApplications as 'false' in the Web.

Does IIS use web config?

The web. config is a file that is read by IIS and the ASP.NET Core Module to configure an app hosted with IIS.

What is location path in web config?

The <location> element typically contains a <system. web> element and other configuration elements exactly as you use them in the Web. config file. The path attribute of the <location> element specifies the virtual directory or the file name where the location configuration items apply.


1 Answers

If there is a specific configuration that you would like to be removed from the inheritance chain, you can use the <clear/> tag to remove any previous reference setting in the parent and you can start fresh.

The following example taken from here show how to remove previous memebership details and create a new one

 <membership>
   <providers>
      <clear/>
      <add name="AspNetSqlMembershipProvider"
          type="System.Web.Security.SqlMembershipProvider, 
                System.Web, Version=2.0.0.0, 
                Culture=neutral, 
                PublicKeyToken=b03f5f7f11d50a3a"
          connectionStringName="MyDatabase"
          enablePasswordRetrieval="false"
          (additional elements removed for brevity)
       />
   </providers>
 </membership> 
like image 132
cableload Avatar answered Oct 12 '22 23:10

cableload