1
votes

I know there are many questions asked on this same issue. but I couldn't find any solution to my problem. so here is my situation.

In our XBAP application, we use ODP.NET component to access oracle database. It works perfectly in development machine. But when I deploy this in production, I get the following exception while running the application.

Type : System.Exception, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Message : Could not load file or assembly 'Oracle.DataAccess, Version=4.112.1.2, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.

Here are the system/SW specifications

Development Machine

  • 32 bit with XP professional
  • .NET 4.0
  • 32 bit ODP.NET 11.2.0.3.0

Production Machine

  • 64 bit with Windows Server 2008
  • .NET 4.0
  • 64 bit ODP.NET

I think the application is trying to access 32 bit version of 'Oracle.DataAccess' DLL, but in Visual Studio I have set the target platform to 'Any CPU'. In production IIS, for app pool, enable 32 bit applications is set to 'false'. 64 bit DLL is also present in GAC. So I think the application must use the 64 bit version of 'Oracle.DataAccess' dll but it doesn't.

2

2 Answers

4
votes

Installing 32 bit version of ODP.NET solved the issue !!

3
votes

One condition for this issue arises when the when platform of the complied project has conflict with current platform setting in the iis. That like you said you are running on a 64bit machine and obviously your iis default setting will permit only 64bit applications on that. Since your ODP/application version is 32bit you need to override the default setting of iis to support 32bit version. Follow the below mentioned steps to enable 32bit environment on iis

• Start iis manager by running “inetmgr” in run prompt

• Expand localhost and select “Application Pools” under that

• Select the “DefaultAppPool” under application pool

enter image description here

• Click on advanced setting under actions tab

• Set “Enable 32 Bit applications” to true in advanced settings

enter image description here

• Click ok and restart iis