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 <[email protected]> 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 > owningConnection, DbConnectionPool pool, DbConnectionOptions options) > at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection > owningObject) > at > System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection > owningObject) > at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection > owningObject) > at > System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection > owningConnection) > at > System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection > outerConnection, DbConnectionFactory connectionFactory) > at System.Data.OracleClient.OracleConnection.Open() > > This is running an web service application in IIS. > a) I have the IIS application pool running as 32 enable. > b) Orcale client was installed as 64 bit and SQLPlus connect testing okay > from console. > c) same configurations project works fine for 2003 server or local x86 32bit > box. (same database) > d) try to build the project to target x86 does not help. > > Any help will be appreciated. > The thing confuse me is that, I have app_pool run with 32bit enable and > Oracle driver installed with 64 bit. it seems to complain the reverse way > think 64 client calling 32 driver. > > -------------- configuration XML ------------------ > > <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> > > <reflection-optimizer use="true" /> > > <session-factory> > > <property name="connection.provider"> > NHibernate.Connection.DriverConnectionProvider</property> > > <property name="dialect">NHibernate.Dialect.Oracle9iDialect</property> > > <property name="connection.driver_class"> > NHibernate.Driver.OracleClientDriver</property> > > <property name="connection.connection_string">Data Source=dcap;User > Id=CAPTURE_USER; Password=captureuser1</property> > > <property name="proxyfactory.factory_class"> > > NHibernate.ByteCode.LinFu.ProxyFactoryFactory, > > NHibernate.ByteCode.LinFu > > </property> > > <property name="show_sql">true</property> > > <mapping assembly="captureDBCore"/> > > </session-factory> > > </hibernate-configuration> -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
