2

Here is my parent site web.config:

<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <sectionGroup name="elmah">
        <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
        <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
        <section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
    </sectionGroup>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
        <section name="Duncan.PEMS.Web.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </sectionGroup>
</configSections>
.....
.....
.....
<entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
.....
.....
.....

My child site web.config:

<configSections>
    <remove name="entityFramework" />
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
.....
.....
.....
<entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
        <parameters>
            <parameter value="PemsUsProEntities" />
        </parameters>
    </defaultConnectionFactory>
    <providers>
    </providers>
</entityFramework>

The problem here is that the parent site needs EF 5.0 and the child site needs EF 6.0. I want to know if I can override it on my child without touching anything on my parent site?

I tried <remove name="entityFramework" /> in child web.config in configSections but it says

Section or group name 'entityFramework' is already defined. Updates to this may only occur at the configuration level where it is defined.

I am using IIS 7.5

HaBo
  • 13,999
  • 36
  • 114
  • 206
  • you mean to say both the Sites are residing in same solution ? – Krsna Kishore Apr 22 '17 at 12:02
  • Not solution. on IIS, I have site on IIS deployed from a solution-A, then I added application under that site, which is deployed from a different solution. Then it turned to be site under site, so parent site configs are conflicting with child site. – HaBo Apr 23 '17 at 07:03
  • Have you looked at "location" settings? https://msdn.microsoft.com/en-us/library/ms178692.aspx – Eris Apr 25 '17 at 00:29
  • This question is answered in another link in overflow [Here is the link](http://stackoverflow.com/questions/782252/avoid-web-config-inheritance-in-child-web-application-using-inheritinchildapplic) – Vahid Vakily Apr 25 '17 at 08:01
  • That doesn't explain about config section. And I tried that on config section which did not work – HaBo Apr 25 '17 at 08:50

0 Answers0