1

I get this error :

Config Error       There is a duplicate 'entityFramework' section defined
Config File    \\?\D:\koopaproject\koopaproject\web.config
9: <!--For more information on Entity Framework configuration, visit     http://go.microsoft.com/fwlink/?LinkID=237468--> 
10:  <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />11:   </configSections>

In my 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=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</configSections>

<connectionStrings>
    <add name="koopaco.com_koopaContext" connectionString="Data Source=localhost;Initial   Catalog=koopaco.com_koopa;Persist Security Info=True;User ID=koopaco.com_zohre;Password=136613;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
</connectionStrings>

And I installed :

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
        <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
    </dependentAssembly>
</assemblyBinding>

But I still get this error.

Hannele
  • 9,301
  • 6
  • 48
  • 68
Neda
  • 119
  • 2
  • 12
  • Did you check web.configs in parents folders or in machine.config that entity framework section is not specified? – Michael Jan 21 '14 at 08:37
  • what do you mean? it's web config in parent folder.and i did all things that i said above on it . – Neda Jan 21 '14 at 08:44
  • What about config files in root directories? %systemroot%\Microsoft.NET\Framework\v4.0.30319\Config\machine.config %systemroot%\Microsoft.NET\Framework\v4.0.30319\Config\web.config – Michael Jan 21 '14 at 08:52
  • i checked web.config and add Entity frame work section and assembly in machine.config but it did not change. – Neda Jan 21 '14 at 09:06
  • Possibly related to: http://stackoverflow.com/questions/19324333/there-is-a-duplicate-entityframework-section-defined-entityframework6-upgrad (currently #6 in the "Related" list). – Codes with Hammer Mar 18 '14 at 14:48

4 Answers4

3

I just had the same problem. The cause of my issue is that whilst I was running the application via IIS (as an application under the Default Web Site), there was a Web.config in the root that also had the <entityFramework> section defined.

Removed the Web.config from the root, and problem was solved.

Brendan Green
  • 11,676
  • 5
  • 44
  • 76
0

If you have this problem while testing in IIS Express, look for a conflict in the higher-level "web.config" used by IIS Express. I found that I had a problem in C:\Users\yourUserIDHere\Documents\IISExpress\config**applicationhost.config**.

applicationhost.config is a sort of higher-level web.config for IIS Express.

My site was defined in there with a left over folder location on my C: drive where I had run an older copy of my project in the past.

Greg Barth
  • 173
  • 1
  • 4
  • 12
0

Add this to web.release.config file

<entityFramework xdt:Transform="RemoveAll" />

so that when you deploy the web application entityFramework will not be on the web app's config file

Ashburn RK
  • 450
  • 3
  • 8
0

Add this to web.config file

<entityFramework xdt:Transform="RemoveAll" />