0

My .net project (Any CPU) is referring to Oracle.dataaccess x86 version . In my local GAC the odac version is x86. But in the web server where it was installed previously was having AMB64 version of odac in GAC . The site was working without any problem . Now I need to move the site to AWS .The windows instance in AWS has the below configuration.

  • OS version : Microsoft windows server 2012 R2 Standard .

  • IIS 8.5

The server is clean and does not have any software installed .

When I try to create a site , I ended up seeing **could not load file or assembly one of its dependencies **. Through forums I installed various libraries from Oracle but I don't understand what are the exact steps needed . I was just doing trial and error.

Please let me know the software or steps to follow which needs do be installed such that my .net site which is connecting to its Oracle database works .

Edit 1 :

Hi ,

I performed the following steps .

  1. As suggested by you I added Oracle.managedDataaccess dll(x86) . It worked well in my local.
  2. Deployed the same code in the server.
  3. I installed the oracle_12.1.0.1.0
  4. In C:/oracle_12.1.0.1.0/odp.net/managed/x86 I ran the bat file for configuring the managed odac in the server. I was able to see the changes in the machine.config file . 5.Now when I ran the site I got the below error .

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'Oracle.DataAccess.Client.OracleClientFactory' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'OraOps12.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) at Oracle.DataAccess.Client.OpsInit.CheckVersionCompatibility(String version) at Oracle.DataAccess.Client.OracleInit.Initialize() at Oracle.DataAccess.Client.OracleClientFactory..cctor() --- End of inner exception stack trace --- --- End of inner exception stack trace --- at System.RuntimeFieldHandle.GetValue(RtFieldInfo field, Object instance, RuntimeType fieldType, RuntimeType declaringType, Boolean& domainInitialized) at System.Reflection.RtFieldInfo.UnsafeGetValue(Object obj) at System.Reflection.RtFieldInfo.GetValue(Object obj) at System.Data.Common.DbProviderFactories.GetFactory(DataRow providerRow) at System.Data.Entity.Internal.LazyInternalConnection.CreateConnectionFromProviderName(String providerInvariantName) at System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings appConfigConnection) at System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name, AppConfig config) at System.Data.Entity.Internal.LazyInternalConnection.Initialize() at System.Data.Entity.Internal.LazyInternalConnection.get_Connection()
at Sample.Data.AbstractEFUnitOfWork2.SetClientId(String clientId)
at Sample.Web.Controllers.ApiControllerBase
1..ctor(IUow uow, IConnectionManager cm, IEnumerable`1 allowedAppUserbases, String connectionName, Boolean allowSaves)

In order to fix this I added OraOps12 dll from c:/oracle_12.1.0.1.0/bin to the wwwroot/site/bin folder. Then I got the below error .

System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed. at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) at System.Data.Entity.Internal.LazyInternalConnection.CreateConnectionFromProviderName(String providerInvariantName) at System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings appConfigConnection) at System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name, AppConfig config) at System.Data.Entity.Internal.LazyInternalConnection.Initialize() at System.Data.Entity.Internal.LazyInternalConnection.get_Connection()
at Sample.Data.AbstractEFUnitOfWork2.SetClientId(String clientId)
at Sample.Web.Controllers.ApiControllerBase
1..ctor(IUow uow, IConnectionManager cm, IEnumerable`1 allowedAppUserbases, String connectionName, Boolean allowSaves)

Checking to resolve this . Appreciate your suggestions.

Bala
  • 1,077
  • 5
  • 15
  • 35
  • Please share the exact error message. And instead of using an Oracle library that depends on a specific Oracle client being installed with the correct bitness, just use the [managed driver](https://www.nuget.org/packages/Oracle.ManagedDataAccess/). – mason Feb 07 '17 at 13:17
  • hi @mason . Added further details in the question . Please check . Appreciate your valuable suggestions . Thanks – Bala Feb 07 '17 at 19:59
  • It appears you still have something using the old Oracle client. With the managed driver, you don't need an Oracle client or any other library in order to talk to Oracle with ADO.NET (although there is a [separate package](https://www.nuget.org/packages/Oracle.ManagedDataAccess.EntityFramework/) you can install if you need EF support). – mason Feb 07 '17 at 20:01
  • I am planning for a reboot and I will just follow the steps again with Oracle managed.I am using Entityframework too . Are u saying if I use Oracle.Managed then I need to use the mentioned package . – Bala Feb 08 '17 at 11:02
  • 1
    Yes, but you can just install the package I last mentioned because it will handle installing the first one for you as well since it's a dependency. – mason Feb 08 '17 at 13:10
  • Hi @Jason . After installing the managed driver (just odac managed ). I didn't get any internal error but I got page cannot be displayed error . Checking to resolve the issue . If not I will do a reboot and install the separate package you have mentioned for EF . – Bala Feb 09 '17 at 09:54

0 Answers0