We have recently been struggling to update our C# applications with the new Oracle DLLs. We create our software for multiple platforms. So our software solution is both a winform desktop application and a ASP.NET MVC webapplication.
Both applications run Oracle 12.1 stand-alone perfectly. We add all necessary Oracle DLLs with the redistribution of our software. So the desktop application has all the DLLs within the MSI and the publish of the website has all the DLLs in the ~\Bin. Making sure that when the website is hosted on IIS the web application runs. This way our customers do not need to install Oracle Client.
Now comes the problem, since updating to Oracle 12.2 it's not possible for us to run the web application any more. The desktop application still runs fine although since Oracle 12.2 we get a Firewall Exception message, if we want to allow our desktop application to connect to the internet.
We didn’t get that message in Oracle 12.1 or below:
We have published our webapplication with all the new Oracle dll’s (the same dll’s as desktop and the same way as for when the webapplication has Oracle 12.1) and since then we are not able anymore to connect to our Oracle databases. We get the error below:
Unable to load DLL 'OraOps12.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
System.TypeInitializationException: The type initializer for 'Oracle.DataAccess.Client.OracleConnection' 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.OracleConnection..cctor()
--- End of inner exception stack trace ---
We have checked, but YES the DLL is there. We also put it in different locations to see if this would work but no.
These are the DLLs we are using:
The strange thing is that when we copy our desktop application to the server, the desktop application runs fine! The desktop application has the exact same DLLs as the web application!
The DLLs we are using for both desktop and web application are from the XCopy folders of Oracle:
http://download.oracle.com/otn/other/ole-oo4o/ODAC122010Xcopy_32bit.zip x86
http://download.oracle.com/otn/other/ole-oo4o/ODAC122010Xcopy_x64.zip x64
There are more people struggling with this issue, here is what we have found so far:
Oracle 12.2 needs minimum .NET Framework 4.5.2 our server has 4.6 and up
The rights of the DLLs are set correctly and may be used by IIS
We have for our x86 web application enabled 32-bit application in the Advanced Settings window
We have set the environment making sure the right DLLs are added to the environment
In Visual Studio we made sure that the references are: Copied if newer and Local copy is set to true
Our application are full x86 or x64 NOT anyCPU build.
We have checked our Regedit, Machine.config and GAC for any possible left-over of other Oracle versions.
Redownloaded the xcopy zip and copied the files again
Server has DISABLED firewall (development)
Oracle.DataAccess.Client Dependencies this is more or less our method to!
Our server-specs:
Windows Server 2012R2 DataCenter (clean)
X64-based pc
using IIS 8.5
This way our customers do not need to install Oracle Client.
I think this is a bad idea, I do not recommend doing it like this.
Either
Ask your customer to install Oracle Client (include ODP.NET provider) by themselves using standard Oracle downloads
or
Use the ODP.NET Managed Driver, then you don't need any further installation. You just have to provide the Oracle.ManagedDataAccess.dll with your application.
It it hard to determine your problem without further information, there could be several reasons:
Missing DLL -> For this I cannot help you, make a normal Oracle installation
Wrong PATH settings. -> Ensure %ORACLE_HOME% and %ORACLE_HOME%\bin are in
How did you check your GAC? Did you usegacutil.exe version 4.0? Older version 3.5 does not show 4.0 (and above) assemblies.
You may have a conflict with 32-bit vs. 64-bit Oracle installation. In case you need both of them, follow this installation instruction: BadImageFormatException. This will occur when running in 64 bit mode with the 32 bit Oracle client components installed
Version of ODP.NET does not match with version of installed Oracle Client. The major release (e.g. 11.1, 11.2, 12.1, 12.2) has to be the same for both.
You can also use Process Monitor tool, in order to see which DLL and/or registry entry is missing.
Related
I have a c# console application which is scheduled to import bulk data from oracle to sql database. I am leaning towards using the oracle client dlls from the installation folder instead of having it installed on server. I read many existing SO answers on copying required dlls in installation folder.
https://jeremybranham.wordpress.com/2011/04/25/oracle-instant-client-with-odp-net/
The application works fine on my windows 10 machine where no oracle client is installed. But on Windows Server 2008 R2 it throws error saying OraOps12.dll is not found. Though I have the dll available. What can I do to troubleshoot the issue?
Make sure the dll is referenced in the project and it's set to copy to the output directory. I can't explain why, but I have had referenced dll's not set to copy and have run into similar issues as you are describing.
I think it is a bad idea to copy the DLL's from the Oracle Client manually. You may provide a copy of Oracle.DataAccess.dll - for all the rest ask your customer to install an appropriate Oracle Client, i.e. the version and architecture has to match the Oracle.DataAccess.dll.
Or use the ODP.NET Managed Driver (Oracle.ManagedDataAccess.dll), this is a stand-alone DLL which does not require any additional file.
Finally I could work it out without actually installing Oracle Client on the server. I was receiving error about not able to load OraOps12.dll but eventually I found out that the dll I was missing was msvcr120.dll. The dll is Microsoft Visual C++ Runtime. So now, I have following Oracle dlls in my deployment folder & the application is working. No changes in configuration are required.
msvcr120.dll
Oracle.DataAccess.dll
OraOps12.dll
oraociei12.dll
oraons.dll
oci.dll
I'm running an Oracle XE 10g in a machinem i've created a test app to test some inserts, launched it in a diferent machine and everything worked fine.
the problem is when I installed the large app in the same machine where oracle XE is installed. When I launch the app I get this error
Oracle.DataAccess.Client.OracleException The provider is not compatible with the version
of Oracle client
en Oracle.DataAccess.Client.OracleInit.Initialize()
en Oracle.DataAccess.Client.OracleConnection..cctor()
en Oracle.DataAccess.Client.OracleConnection..ctor()
en Test.DB.Oracle.OracleManagerConnection.GetConnection()
on this line OracleConnection conn = new OracleConnection()
I don't know how can it work from a machine and doesn't work in a different machine. The problem is in a Windows Server 2008 x64 (alredy copied the Oracle.DataAccess.dll to the .exe directory).
ODP.NET is a real PITA, mainly because the error message are so vague.
The following may trigger this error message:
Your Oracle.DataAccess.dll is 32 bit and the unmanaged DLLs it finds and tries to use are 64 bit or vice versa
It doesn't find the unmanaged DLLs at all
The versions of the unmanaged DLLs are really different to the ones Oracle.DataAccess.dll needs
Please be aware that the process that Oracle.DataAccess.dll uses to locate the unmanaged DLLs is pretty complicated, because it is a multi-step process that takes into account environment variables, registry values etc.
There might be another case, such as running a 64bit .net run-time against a 32bit oracle client. So can you check whether the machine which host small application runs of x64 or 32bit. If it is 32bit, then obviously the copied provider will not work on X64 windows server. In such case, you either need to download 64bit provider version Or set the target CPU flag on large project ( in VS) to run in the 32bit run-time.
I am new to .NET application.
I have developed the application on 32 bit OS with Visual Studio 2008.
The application required the Microsoft.Interop services and for PDF services to open PDF files and MS Office files.
It also required SQL Express for database operations.
The application works fine on 32bit OS.
Then I created the setup for 64 bit OS, I added a new Setup project with wizard in Visual
Studio 2010 and select the Primary output and Localized resources.
But it does not included the Resources folder to the Application folder.
I set the target machine 64x and build the project, also before building give the prerequisites to the project which is Windows Installer 3.1, and .net framework 4.0, I have used the .net framwork 3.5 in the application.
Then I ran the setup, which executed successfully.
But when I tried to run the application it gave the message "Application has stoped working. Finding for the solution from the web.." and it closed.
Then I saw that there was no resources folder so I just copied the resources folder to the application where it was installed. Then the application worked fine.
So I created the setup again but this time I also provided the Resources folder to the application folder. Built the Setup and tried to run the application but the same message is prompted to me as it was giving before "Application has stopped working...", so I looked for the resource folder and all the required files which were there.
Creating a separate 64-bit version makes no sense in your case.
You have dependencies to 32-bit components; as a consequence, all1 your assemblies must be compiled to the x86 target platform and be installed using a 32-bit MSI.
If you get an "Application has stopped working..." error, this indicates that an exception occurred that has not been handled by your process. You can get the stack trace e.g. from the event log.
1 In fact, at the least the entry assembly must have an x86 target platform, and all other assemblies must have either an x86 or AnyCPU target platform.
Check you have changed the platform target to x64 or AnyCPU in your project -> Build Properties
hey friends thanks for answering my question. Finally doing a lot of things I found that it was converting the sql database to 2008 while creating the setup. And I was setting the sql express 2005 on the client machine. Then I changed the sql server 2005 to sql express 2008 and run the setup. Then I found that at the first time the exe required all the rights to convert so I tried the setup Run as Administrator and bingo the setup works for 2 different pc..
The only thing is required that at first time I need to run the application as Administrator.
Thanks for help I
I've created a very simple console app in .NET 4.0 that will run as a scheduled task. It looks for local files that are unmodified for a certain amount of time and then parses the file, inserts a record into a MySQL database, and copies the file to the network. I'm using a local SQLite database to track which files have already been processed, but unfortunately I'm running into a problem on one system at the first SQLite operation:
System.BadImageFormatException: Could not load file or assembly 'System.Data.SQLite.dll' or one of its dependencies. is not a valid Win32 application. (Exception from HRESULT: 0x800700C1) File name: 'System.Data.SQLite.dll'
at FileDatabase.CreateDatabaseAndTable()
at Program.Main(String[] args)
This exception is thrown on one system (Windows 7 x64 Home Premium with .NET 4.0 full), but is not thrown on two other systems (dev system + one other, both Windows 7 x64 Professional with .NET 4.0 full).
From browsing other questions, I see that this can happen when the program is run in 64-bit mode since the SQLite DLL is the 32-bit version. The first thing I checked is that the active platform is x86 in the Visual Studio Configuration Manager. I also used IL DASM to verify that the output exe is 32-bit (.corflags 0x00000003 // ILONLY 32BITREQUIRED). I would prefer to keep the 32-bit SQLite DLL and target platform as x86 so that I do not have to make different versions of the application for 32- and 64-bit computers.
I've also read that this exception can occur because of a corrupted DLL file, but since it works on some computers, I think this is not the case.
Other things I've tried on the problem system that didn't help:
Searching the GAC and Windows directory for errant SQLite DLLs, but found none.
Turning off AVG anti-virus.
Running the exe directly instead of the published ClickOnce application.
Uninstalling and reinstalling the ClickOnce application.
Any suggestions would be appreciated - thanks!
Installing the full setup package from system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki seems to have solved the problem - it must have been some dependency that was not present (possibly in Windows 7 Professional but not Home?). While this solution isn't perfect for a big deployment, I really just needed it on this one computer. Thanks for RoadBump for getting me on the right path.
I am trying to connect to DB2 from .NET 2.0 application in my development machine running windows 7 64 bit.
I am getting this error in open method. Could not find a solution.
ExceptionType: InvalidOperationException
ExceptionMessage: SQL1159 Initialization error with DB2 .NET Data Provider, reason code 2, tokens D:.......................\bin\db2app.dll,
StackTrace: at IBM.Data.DB2.DB2ConnPool.Open(DB2Connection connection, String& szConnectionString, DB2ConnSettings& ppSettings, Object& ppConn)
at IBM.Data.DB2.DB2Connection.Open()
Learnt this from a colleauge of mine. Issue was because db2app.dll was missing in bin directory of application folder.
Copied db2app.dll and db2app64.dll from C:\Program Files\IBM\SQLLIB\BIN to bib folder of application and it worked fine.
See the "user response" at the bottom of the IBM doc for SQL1159N, which also lists the various reasons you might receive this error code:
There was a problem with your DB2 installation. If this is the first time DB2 was installed on this computer, review the install logs for any possible errors and run a repair of DB2 from the Add/Remove Programs control panel applet. The default location of the installation logs is the My Documents/DB2LOG folder of the user that performed the installation. If this does not resolve the issue please contact IBM Support and provide the reason code associated with this message along with any installation logs.
I had a 32 bit DB2 Client and I was accessing it from a Web Application hosted on IIS, using Application pool (with 'Enable 32-bit Application' set to false). In this case a
64 -bit client (db2app64.dll)
is expected while db2app.dll will throw above error.
Just FYI..
It is hard to debug this error in Visual studio as by default IIS express uses 32-bit application pool. To change it to 64-bit, one has to make changes in registry (set Use64BitIISExpress to 1) There is no inetmgr for IIS Express.
After speaking to IBM, they recommend strongly against putting IBM dlls inside the bin folder. We let IBM remotely configure our server and now all works well and we must not put the ibm*.dll into our bin folders or it will not work.