2013-10-01 61 views
1

我有一个.NET 4.0与ODAC 11.2.0.3.20(ODP.NET 2.112.3.0)使用Entity框架项目在本地主机上正确运行。ODAC 11.2.0.1.2(ODP.NET 2.112.1.2)是否支持.NET Entity Framework?

我在这个问题上一直在挠头。我在安装了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中

回答

1
在ODAC

实体框架的支持似乎是第一个可用的11.2.0.3.0:

ODP.NET 11.2.0.3.0, and higher, includes support for the ADO.NET Entity Framework and LINQ to Entities. ODP.NET also supports Entity SQL.

如果你的环境无法更新到ODAC的更高版本,则可能必须恢复为非EF代码。我猜你所宣传的环境是一个共享的环境,这会使管理员的抵制情绪合理化。

+1

或者为您的EF代码使用ODP.net管理的驱动程序。 – Jesse

+0

感谢您使用托管驱动程序的建议。我试图切换到没有成功的托管驱动程序。我在这里提出另一个问题。 http://stackoverflow.com/questions/19231417/how-to-switch-my-project-from-using-unmanaged-to-managed-odp-net – imObjCSwifting

相关问题