ASP.Net子应用程序抛出entityframework错误。

时间:2021-08-24 02:16:45

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

我有一个ASP.Net MVC子应用程序,它使用EntityFramework 6.2.0和.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:

此Web应用程序作为子应用程序运行到使用EF5的旧ASP.Net MVC站点。当我尝试运行子应用程序时,我收到错误:

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)

ExceptionMessage =为entityFramework创建配置节处理程序时发生错误:无法加载文件或程序集'EntityFramework,Version = 5.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'或其依赖项之一。定位的程序集的清单定义与程序集引用不匹配。 (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.

我假设我必须在子应用程序的web.config AssemblyBinding部分中执行依赖程序集配置。我必须使用“System.Web.Http”和“System.Web.Http.WebHost”做类似的事情,但EntityFramework似乎可能有点不同。

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?

或者EF有更多吗?

1 个解决方案

#1


0  

Resolved by adding to the web.Config

通过添加到web.Config解决

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

#1


0  

Resolved by adding to the web.Config

通过添加到web.Config解决

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