gpt4 book ai didi

asp.net-mvc - 无法加载 Entity Framework 提供程序类型 'Oracle.ManagedDataAccess.EntityFramework'

转载 作者:行者123 更新时间:2023-12-02 18:23:53 26 4
gpt4 key购买 nike

我正在尝试在 MVC 应用程序中使用 Entity Framework v6 使用 Oracle Data Provider.NET (ODP.NET) 连接到 Oracle。

我已经从这里安装了 ODP.NET: https://www.nuget.org/packages/odp.net.entityframework/6.121.1-beta

我的 web.config 文件配置如下:

<connectionStrings>
<add name="MyDB" connectionString="User ID=MyUser;Password=MyPassword;Data Source=MyDatabase; Persist Security Info=False" providerName="Oracle.ManagedDataAccess" />
</connectionStrings>



<entityFramework>
<providers>
<provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</providers>
</entityFramework>

但是,当我尝试调用 EF Context 时,出现以下错误:

The Entity Framework provider type 'Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342' registered in the application config file for the ADO.NET provider with invariant name 'Oracle.ManagedDataAccess.EntityFramework' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application

我花了很多时间寻求这方面的帮助。将非常感谢任何帮助!

谢谢!

马丁

最佳答案

将此部分添加到 web.config 以及上述步骤似乎已经修复了此问题:

<system.data>

<DbProviderFactories>

<add name="ODP.NET, Managed Driver"
invariant="Oracle.ManagedDataAccess.Client"
description="Oracle Data Provider for .NET, Managed Driver"
type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>

</system.data>

关于asp.net-mvc - 无法加载 Entity Framework 提供程序类型 'Oracle.ManagedDataAccess.EntityFramework',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28971910/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com