Mat Richardson
Mat Richardson

Reputation: 3606

MVC: Duplicate Entity Framework Section

I've an MVC application that runs from the root of my IIS instance that works fine with no problems.

I've deployed another application to a subfolder of that application to run as a separate application to it. The 'root' application works just fine but when I try to open the other I get a '500.19 - Internal Server Error' that tells me I have a duplicate entity framework section.

Looking at previous questions I've seen various suggestions but none of these seem to work.

More info - here is the section from the 'root' application.

<section name="entityFramework"
type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, 
EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=...." 
requirePermission="false" />

And this is the other:-

<section name="entityFramework" 
type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, 
EntityFramework, Version=5.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089" requirePermission="false" />

I've tried:-

Any help would be appreciated.

Upvotes: 1

Views: 816

Answers (1)

Chris Pratt
Chris Pratt

Reputation: 239300

I believe the error is actually complaining about the literal <entityFramework> section, not the definition of the section in the <configSections> node. However, simply removing it from the child application may have side effects if there's anything specific in the configuration for that child application. The best thing to do in situations like this is to turn off inheritance in the parent Web.config:

<entityFramework inheritInChildApplications="false">
    ...
</entityFramework>

Unfortunately, there's no way to just turn off inheritance completely, so you'll need to just keep adding this attribute to nodes of the parent Web.config as necessary until the child application finally loads.

Upvotes: 1

Related Questions