0

This is my case, I have the Oracle 11.2.0.3.0 64-bit client installed, when I add in the project the Oracle.DataAccess dll that comes in the Oracle ado.Net folder and compile the project on my machine if it works for me. Therefore, when I publish the project on the server, where I also install the same client that I have installed on my machine, the project does not work for me, it sends me an error message:
I have to use this version of Oracle to connect to an old version of Oracle (Oracle 9i).

Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format.


[BadImageFormatException: Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format.] System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0 System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +34 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +16 System.Reflection.Assembly.Load(String assemblyString) +28 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38

[ConfigurationErrorsException: Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format.] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +736 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +217 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170 System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +91 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +284 System.Web.Compilation.BuildManager.ExecutePreAppStart() +153 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +521

[HttpException (0x80004005): Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9969128 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254


I already tried publishing the project as"Any CPU", "64bits" and it still marks the same error, could you help me with this problem?
enter image description here


ODAC 11.2
https://www.oracle.com/technetwork/topics/dotnet/downloads/install112030-1440546.html

andres martinez
  • 281
  • 1
  • 4
  • 12
  • This might be helpful (https://stackoverflow.com/a/4619327/12511801)[https://stackoverflow.com/a/4619327/12511801]. – Marco Aurelio Fernandez Reyes Jan 15 '20 at 17:21
  • hi @MarcoAurelioFernandezReyes This does not affect other applications that are published in the IIS? – andres martinez Jan 15 '20 at 17:37
  • You ask the same question again and again: https://stackoverflow.com/questions/59667959/error-opening-oracle-connection-on-server-ora-3134, https://stackoverflow.com/questions/59741601/problem-replacing-a-reference-in-visual-studio-asp-net, https://es.stackoverflow.com/questions/321575/problema-al-reemplazar-una-referencia-en-visual-studio-asp-net, https://es.stackoverflow.com/questions/320518/error-al-abrir-la-conexion-oracle-en-el-servidor-ora-3134. – Wernfried Domscheit Jan 15 '20 at 19:04
  • I asked already to verify which DLL is actually loaded. Check with `Connection.GetType().Assembly.Location`. Check your GAC (with `gacutil.exe`), perhaps you should remove all Oracle components completely (see https://stackoverflow.com/questions/8450726/how-to-uninstall-completely-remove-oracle-11g-client) and install a fresh Oracle Client include Oracle Data Provide for .NET – Wernfried Domscheit Jan 15 '20 at 19:07
  • @andresmartinez none of the comments and answers in your duplicatd questions solved your problem? if not, **please keep updated 1 question only** *(you can keep 1 question updated in es.stackoverflow too, though)* - explain why those solutions didn't work. – Marco Aurelio Fernandez Reyes Jan 15 '20 at 19:11
  • @WernfriedDomscheit is there a way to flag such questions for be deleted? - I'm flagging per link, but I think moderators should handle this situation. – Marco Aurelio Fernandez Reyes Jan 15 '20 at 19:13
  • 1
    @MarcoAurelioFernandezReyes, I closed two out of three. For the Spanish version I don't have sufficient reputation. The open one is https://stackoverflow.com/questions/59741601/problem-replacing-a-reference-in-visual-studio-asp-net – Wernfried Domscheit Jan 15 '20 at 20:47
  • @WernfriedDomscheit thank you. – Marco Aurelio Fernandez Reyes Jan 15 '20 at 20:56
  • I'm sorry but, there were problems that arose, according to the changes from 32 bits to 64 – andres martinez Jan 15 '20 at 21:16
  • This one may also help: https://stackoverflow.com/questions/659341/the-provider-is-not-compatible-with-the-version-of-oracle-client#25412992 – Wernfried Domscheit Jan 16 '20 at 06:38

0 Answers0