ASP.Net sub application throwing entityframework error.

1

I have a ASP.Net MVC sub-application that uses EntityFramework 6.2.0 and .Net Framework 4.6.1

This web app runs as a sub app to an older ASP.Net MVC site that uses EF5. When I try to run the sub-app I am getting the error:

ExceptionMessage=An error occurred creating the configuration section handler for entityFramework: Could not load file or assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I assume I have to do something with dependent assembly configuration in the sub-app's web.config AssemblyBinding section. I've had to do similar things with "System.Web.Http" and "System.Web.Http.WebHost" but EntityFramework seems like it might be a bit different.

Do I just add

<dependentAssembly>
    <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" />
    <bindingRedirect oldVersion="1.0.0.0-6.2.0.0" newVersion="6.2.0.0" />
  </dependentAssembly>

Or is there more to it for EF?

c#
asp.net-mvc
entity-framework
asked on Stack Overflow Sep 14, 2018 by John S

1 Answer

0

Resolved by adding to the web.Config

<dependentAssembly>
    <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" />
    <bindingRedirect oldVersion="1.0.0.0-6.2.0.0" newVersion="6.2.0.0" />
  </dependentAssembly>
answered on Stack Overflow Sep 14, 2018 by John S

User contributions licensed under CC BY-SA 3.0