FireBird .net provider 64bit - c#

I'm trying to get a firebird web application (IIS6 64 bit) to run. However I'm getting bad image format (bit difference incompatability) issues. Has anyone got any advice to get it running.
Details AnyCPU application references the .net firebird driver (through nhibernate) which uses a native 64bit dll. There is a native 32bit dll which I use for local development and it works fine. (I havn't got the 32 version working on the 64 bit server either).

This issue actually formed from how we deployed our website. The site is packaged on a 32bit computer what I didn't realize is that it also packed the 32bit native fire-bird dll's instead of the 64bit ones.

Related

Deployed 64bit c# application can't load unmanaged dll

I have a 64bit web application written in c# deployed to IIS on both windows server 2008 (IIS 7) and windows server 2012 (IIS 8).
Part of the application involves accessing an unmanaged c++ DLL from c# code. This call is failing when I deploy to IIS. I get the classic:
An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
I have read many threads on the topic, including:
An attempt was made to load a program with an incorrect format ERROR
“An attempt was made to load a program with an incorrect format” even when the platforms are the same
But I don't think they apply as
I have a 64 bit application.
It's compiled as x64
It's deployed as x64
I have verified it is running under an x64 IIS appPool.
enable32bitapplications is set to false.
Both the c# dll importing and the unmanaged dll are compiled to 64bit.
I have deployed to IIS on the server machines in both Release and Debug mode - no difference.
There are 32 bit dlls in the application, but they are in completely separate projects which are not referenced by, nor reference, the project that is throwing the error.
For additional information, it runs fine on both my local machine in IIS express AND my local machine when deployed through IIS (windows 7), so there is a disconnect somewhere and I can't track it down.
Additional info:
The unmanaged DLL does have dependencies on:
Kernel32.dll
Advapi32.dll
Crypt32.dll
User32.dll
Version.dll
I realize these are 32bit I thought these were 32bit, but on a 64 bit machine these live in System32, so I'm not sure... but if so, how can I get it to compile as the unmanaged DLL itself is compiled to 64 bit.
Also, why would it work locally for me?
Also, I have (just for kicks and skittles) set Enable32BitApplications to True and I get the same error, as my project is a 64 bit project and references a 64bit unmanaged DLL, which can't run in a 32 bit process.
There was an additional dependency for the unmanaged DLL that was a c++ redistributable dll. The copy of that DLL on the machine was 32 bit, once I swapped out the version to be 64 bit, it loaded just fine.
Lesson learned, all dependencies of the DLL must be present and the correct Bitness.
You need to set Enable32bitApplications to true in IIS.

Deploying application using SQL Server CE 4.0 SP1 using "Any CPU"

I am planning to create an application which uses SQL Server CE 4.0 SP1 using private deployment.So now i am planning to use private deployment. So all the dll must be included in the project as explained here.
But I tried just adding all dll from my XP PC (32 bit) and not added any 64 bit dlls (but it was mentioned to add 64 bit dlls). Then i set platform to "Any CPU". After building application i tried running my application in a 64 bit PC and it worked properly!!! I was expecting it would give error as i have not included 64 bit dlls.
Then I used isWow64Process api to check whether the application is really running on 64 bit. It returned false when i set "any cpu" and 64 bit, means it runs on 64 bit.When i set to x86 it returns true which means it is running under wow64(as 32 bit process). If I set it to x64 it works properly in 64 bit pc, but SQL Server CE dlls are of 32 bit. why does this happen? My plan is to use "Any cpu" so that it works as 32 bit in 32 bit PC and 64 bit process in 64 bit pc. So what i am missing. Why does it work even if i set any cpu or x64?
EDIT:
I have found the reason why it was working on 64 bit PC.its because the pc already had SQL CE 4.0 SP1 installed. So application used dll from installed path instead of using files from app path where it had 32 bit dll which dont support 64 bit application(any cpu).
But now I am following the link mentioned above and added x86 and AMD64(not x64 as mentioned in that link) folder and corresponding dlls and Microsoft.VC90.CRT dlls properly, it works properly on windows 7(.net 3.5 by default- sql ce is not installed). In windows XP sp3 (fresh install with only OS) I installed .net 2.0 and then run my application. It worked!!
1) So does SQL CE 4.0 SP1 private deployment require .net 3.5? Will it cause any other problem if i use only .net 2.0?
2)I found like we need to modify app.config to refer to the Private ADO.NET provider, which has assembly version 4.0.0.1, not 4.0.0.0 as the on in the GAC which is mentioned here I have not done this and it and my application worked properly. So is it required to do? If i don't add it will it cause error in any .net framework?
3) I have not included System.Data.SqlServerCe.Entity dll. I am using SqlCeConnection to connect to database. So is there any need of adding System.Data.SqlServerCe.Entity dll? Also some where i found like this dll require .net 3.5 so microsoft recommends installing .net 3.5 for private deployment of SQL CE 4.0 SP1(related to my 1st question)?
You can download my project here

Unable to load DLL “OraOps10.dll”

I am running into peculiar issue. I am developing a windows based application which connects to Oracle database.
For initial testings, I have created installer and tested on different machines that I have. Each machine has Oracle Client installed and I did not see any problem in running application.
But when I share this installer with customer, he is getting error "Unable to load DLL OraOps10.dll". When asked he mentioned and has shown the Oracle Client installed on his machine and he is able to run other C# applications which connects to Oracle databases.
I do not understand why my application only getting above error. I even tried suggestions shared at https://forums.oracle.com/forums/thread.jspa?threadID=67364 but still no luck.
I even tried copying executables & DLLs manually on customer's machine. But still facing same issue.
So please help me on what else i can do.
Thanks & Best Regards
Sudhakar Chavali
P.S:
I am using Windows XP operating system and customer is also using same operating system. Both machines are of type 32 bit OS only.
This is the location where customer's oracle client installed:
C:\oracle\product\10.2.0\client_1\bin and same is the version in my case too.
We both are using Oracle 10g.
The ODP.NET drivers basically consist of two parts. The .NET part and the native OCI part. The error message indicates that the .NET part is working but fails to load the native part.
These issue are likely causes:
There's a version mismatch between the .NET part and the native part. Note that OraOps10.dll belongs to Oracle 10g. So the .NET part isobviously of version 10, and it is looking for a native part for version 10.
There could be a bitness mismatch. If the .NET part is running in 64 bit mode, it'll be looking for the 64 bit native OCI DLLs. On a 64 bit system, the task manager can tell you whether the process is 32 or 64 bit. 32 bit processes are marked with *32.
The registry might not contain the correct path to the native DLLs. ODP.NET will retrieve the value of HKEY_LOCAL_MACHINE\Software\Oracle\ODP.NET\2.xxx.x.x\DllPath to locate the OCI DLLs. Note that the registry is split into a 32 and 64 bit part. Depending on the process looking into the registry, it'll get different values.
It's best if you add all the available information to your question. Is it a 64 bit operating system? Is it a 32 or 64 bit process? Which version of the Oracle client was installed? What directory was the Oracle client installed? Can you see the correct registry entries?
As for me, I am getting Unable to load DLL "OraOps12.dll" error message.
It is a web application, and I am using Oracle XE. Both the web application (the client app) and the Oracle XE database server is installed on the same machine.
The Oracle XE database server comes with its own Oracle 11 client, but the ASP.NET MVC web app is using Oracle 12 client. Even though I installed Oracle 12 instant client on the machine, the ASP.NET MVC website could not see it, it keeps complaining "Unable to load DLL OraOps12.dll".
What I had to do was edit the registry at HKLM\Software\Oracle\ODP.NET\DllPath to point to the Oracle 12 instant client instead of the Oracle 11 client that gets installed with the Oracle XE.
I will post a more detailed explanation later once I am free.
I suspect that either the entire Oracle client was not installed OR an earlier version was installed.
You should have the customer verify that the version of the Oracle client that is installed matches yours and that the entire client, not just the .Net portion, was installed.
Can you throw some more light on this issue like whether the target OS is 32 or 64 bit. Try to generate the x86 and 64bit installers and check with your clients machine. If not the Oracle client may not be properly installed in the client pc. These issues are a little bit tricky to handle. Try to look at it in other directions.

DLL Errors in 32 bits machine. Program made in C#

I did a program in C# which runs perfectly in my machine and in another one, of 64 bits, which have the .NET Framework.
When I try to run the program in a 32 bits machine It explodes and I get:
In this link (http://geekswithblogs.net/steveclements/archive/2008/04/30/error--eventtype-clr20r3.aspx) I found some solutions, but none worked for me. I already deleted the not used DLL, in particular those involving MySQL.
Do you have any suggestions?
Thank you.
This question requires more error details like exception information, VS version, What kind of exe (Winforms, WPF, etc), but you can start by answering the following questions:
- Is your exe built for anyCPU?
Is the same .net framework version installed on both 64-bit and 32-bit PC?
Are you having any code that uses 64-bit dll?
Are you having any code that uses 64-bit constructs? (checking pointer size)
What VS/.net framework/OS version does your developer PC has? The 32-bit PC?

oracle error in windows-7 64bit

I installed windows-7 64 bit. When I try to run my program (that works with Oracle 11g) I get this error:
Attempt to load Oracle client libraries threw BadImageFormatException
this problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed
What can be the problem ? Where I can download 64 bit oracle client ?
(can I get any link for download)
thanks in advance
Have you tried download the 64bit Oracle Client from:
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-win64soft-094461.htmlBlockquote
This looks like it might be the correct download:
Oracle Database 11g Release 2 Client (11.2.0.1.0) for Microsoft Windows (x64)
win64_11gR2_client.zip (615,698,264 bytes) (cksum - 2947608743)
Contains the Oracle Client Libraries. Download if you want the client libraries only
Alternatively, if you cannot obtain a 64 bit version of the Oracle client and are stuck with the 32 bit version, then you can either:
rebuild your .NET application to
only run as a 32 bit (x86) process
instead of "Any CPU" or
use CorFlags.exe (CorFlags
Conversion Tool) to reconfigure
your existing .NET application exe
to run as 32 bit without having to
rebuild it.

Categories