Thanks for the reply, Turibbio.
I understand this is a platform related issue. However still having trouble
to find a solution.

I've check the C:\windows\Assembly for 2008 R2
The two oracle entry in there are
Oracle.dataaccess AMD64
oracle.web AMD64
I dont see another location

for the 2003 server GAC
Oracle.DataAccess x86
Oracle.Web x86.

I guess I could try to have x86 oracle driver intalled on this box instead??
I guess I could also try to convert into using ODP.NET <http://odp.net/>
 driver.

So what platform your application running under? anyCpu x64 or x86 ?
and also could you send me ur hibernate configuration?

thanks

Ying Guo
On Wed, Feb 23, 2011 at 4:09 PM, turibbio <[email protected]> wrote:

> 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<http://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(St­ring
> > userName, String password, String serverName, Boolean integratedSecurity,
> > Boolean unicode, Boolean omitOracleConnectionName)
> >    at
> >
> System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionStr­ing
> > connectionOptions)
> >    at
> >
> System.Data.OracleClient.OracleConnectionFactory.CreateConnection(DbConnect­ionOptions
> > options, Object poolGroupProviderInfo, DbConnectionPool pool,
> DbConnection
> > owningObject)
> >    at
> >
> System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConne­ction
>  > 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.
>
>

-- 
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.

Reply via email to