2013-10-01 97 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

相關問題