Hi Ying Guo, I've faced the same problem few days ago.
First of all, I've to clearify one thing, it is not an NHibernate
related problem!
Here is what worked for me: if you don't know, Win Server 2008 R2 has
2 different folder for GAC (GAC_32 & GAC_64). You have to check if, in
the right folder based on what target platform you've chosen compiling
your software, there's an Oracle.DataAccess.dll (or
OracleDataClient.dll if you use old .Net provider). The
BadImageFormatException it's an exception that come up when .net
engine will find a mismatch between target platform.
Anyway, you can also set to false the IIS setting about 32 bit. If
your app is compilied in 32 bit, it will looking for in GAC32 for
Oracle Driver.
In my app I've used Oracle.DataAccess.dll and I have installed
ODP.NET
with ODAC (11g R2) on our service tier (where NHibernate apps are
hosted). Besides, SQLPlus, if tnsnames is correctly configured, will
always log you in, 'cause it doens't use .net oracle provider, but
oracle native provider.
HTH, anyway I'm here :)
On 23 Feb, 21:25, Ying Guo <
hen...@gmail.com> wrote:
> When I trying to migrate into 2008 64bit I am getting the following
> exception
>
> System.Reflection.TargetInvocationException: Exception has been thrown by
> the target of an invocation. ---> System.InvalidOperationException: 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. ---> System.BadImageFormatException: An attempt was
> made to load a program with an incorrect format. (Exception from HRESULT:
> 0x8007000B)
> at System.Data.Common.UnsafeNativeMethods.OCILobCopy2(IntPtr svchp
> IntPtr errhp, IntPtr dst_locp, IntPtr src_locp, UInt64 amount, UInt64
> dst_offset, UInt64 src_offset)
> at System.Data.OracleClient.OCI.DetermineClientVersion()
> --- End of inner exception stack trace ---
> at System.Data.OracleClient.OCI.DetermineClientVersion()
> at
> System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String
> userName, String password, String serverName, Boolean integratedSecurity,
> Boolean unicode, Boolean omitOracleConnectionName)
> at
> System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionString
> connectionOptions)
> at
> System.Data.OracleClient.OracleConnectionFactory.CreateConnection(DbConnectionOptions
> options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection
> owningObject)
> at
> System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection