简体   繁体   中英

How do I solve System.TypeLoadException without messing with the GAC?

My question is remarkably similar to this: Oracle .Net ManagedDataAccess Error: Could not load type 'OracleInternal.Common.ConfigBaseClass' from assembly

However, there are two reasons why I'm not going with the consensus.

1) I'm not sure it would work. I don't know a lot about the GAC, but I looked in the assemblies folder and there isn't a copy of Oracle.ManagedDataAccess with version 4.121.2.0. All the Oracle.ManagedDataAccess assemblies begin with 2.

2) I'm only getting this error on the production server, and I (as a lowly dev) don't want to take any action on the production server that could affect the multitude of applications it houses.

This is my stack trace:

Failure: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. 
---> System.TypeInitializationException: The type initializer for 'Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices' threw an exception. 
---> System.TypeLoadException: Could not load type 'OracleInternal.Common.ConfigBaseClass' from assembly 'Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342'.
   at Oracle.ManagedDataAccess.EntityFramework.EntityFrameworkProviderSettings.Oracle.ManagedDataAccess.EntityFramework.EFProviderSettings.IEFProviderSettings.get_TracingEnabled()
   at Oracle.ManagedDataAccess.EntityFramework.EFProviderSettings.InitializeProviderSettings[T]()
   at Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices..ctor()
   at Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices..cctor()
   --- End of inner exception stack trace ---

The problem is that the server is using a different version of the Oracle Client than you are. I run into this often. The only solutions I've found are either to ensure I'm using the DLL that is used by the server, or updating the server to my version of Oracle Client. As long as the other version is lurking in the GAC, your local version is likely to be ignored.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM