1

我有一个带有 ODAC 11.2.0.3.20 (ODP.NET 2.112.3.0) 的 .NET 4.0,它使用在 localhost 上正确运行的实体框架项目。

我一直在为这个问题挠头。我在安装了 ODAC 11.2.0.1.2 (ODP.NET 2.112.1.2) 的新 IIS 7.5 服务器上一直遇到这个问题。

我认为这是因为 ODP.NET 2.112.1.2 不支持实体框架。我不使用 EF 的旧代码仍然有效,但是一旦我点击 EF 代码,它就会中断。

管理员不想更新 ODP.NET。如何使我的网站在此服务器上运行?谢谢

    The provider is not compatible with the version of Oracle client

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: Oracle.DataAccess.Client.OracleException: The provider is not compatible with the version of Oracle client

Source Error: 


Line 22:         using (BOTEntities context = new BOTEntities())
Line 23:         {
Line 24:             var data = (from com in context.COMMITEETYPEs
Line 25:                        join comComp in context.COMMITTEECOMPs on com.COMMITEETYPEID equals comComp.COMMITTEEID
Line 26:                        where com.ACTIVE == 1

Source File: c:\xxxx\Competency\Competency.aspx.cs    Line: 24 

Stack Trace: 


[OracleException (0x80004005): The provider is not compatible with the version of Oracle client]
   Oracle.DataAccess.Client.OracleInit.Initialize() +750
   Oracle.DataAccess.Client.OracleClientFactory..cctor() +103

[TypeInitializationException: The type initializer for 'Oracle.DataAccess.Client.OracleClientFactory' threw an exception.]

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeFieldHandle.GetValue(RtFieldInfo field, Object instance, RuntimeType fieldType, RuntimeType declaringType, Boolean& domainInitialized) +0
   System.Reflection.RtFieldInfo.UnsafeGetValue(Object obj) +124
   System.Reflection.RtFieldInfo.InternalGetValue(Object obj, StackCrawlMark& stackMark) +132
   System.Reflection.RtFieldInfo.GetValue(Object obj) +21
   System.Data.Common.DbProviderFactories.GetFactory(DataRow providerRow) +220
   System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) +88
   System.Data.EntityClient.EntityConnection.GetFactory(String providerString) +27
   System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) +246
   System.Data.EntityClient.EntityConnection..ctor(String connectionString) +43
   System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings appConfigConnection) +185
   System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name, AppConfig config) +79
   System.Data.Entity.Internal.LazyInternalConnection.Initialize() +289
   System.Data.Entity.Internal.LazyInternalConnection.CreateObjectContextFromConnectionModel() +36
   System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +286
   System.Data.Entity.Internal.InternalContext.Initialize() +31
   System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +39
   System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +137
   System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +38
   System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +84
   System.Linq.Queryable.Join(IQueryable`1 outer, IEnumerable`1 inner, Expression`1 outerKeySelector, Expression`1 innerKeySelector, Expression`1 resultSelector) +96
   Competency_Competency.fillPage() in c:\websites\Trustees4.0\BOT\ipad\Competency\Competency.aspx.cs:24
   Competency_Competency.Page_Load(Object sender, EventArgs e) in c:\websites\Trustees4.0\BOT\ipad\Competency\Competency.aspx.cs:15
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +92
   System.Web.UI.Control.LoadRecursive() +54
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18044

这是web.config

4

1 回答 1

1

ODAC 中的实体框架支持似乎首先在 11.2.0.3.0 中可用:

ODP.NET 11.2.0.3.0 及更高版本包括对 ADO.NET 实体框架和 LINQ to Entities 的支持。ODP.NET 还支持实体 SQL。

如果您的环境无法更新到更高版本的 ODAC,您可能必须恢复为非 EF 代码。我猜您要推广的环境是一个共享环境,这将使管理员的抵制合理化。

于 2013-10-01T21:48:51.050 回答