Last post Dec 20, 2011 10:02 AM by NamelessParanoia
Jan 28, 2011 11:47 PM|susan8|LINK
I have a vs2008 web application. it built fine and it was runing fine use visual studio development server, but when i use IIS web server, it gave me the following error, Can you anybody help with that? Thanks.
Server Error in '/Vendorapplication' Application.
Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated
in the code.
System.BadImageFormatException: Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format.
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception
can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the
assembly 'Oracle.DataAccess' could not be loaded.
=== Pre-bind state information ===
LOG: User = IIS APPPOOL\Vendorapplication
LOG: DisplayName = Oracle.DataAccess
LOG: Appbase =
LOG: Initial PrivatePath = C:\Vendorapplication\Vendorapplication\bin
Calling assembly : (Unknown).
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Vendorapplication\Vendorapplication\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL
file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/Temporary ASP.NET Files/vendorapplication/8cc1d433/257b7ed7/Oracle.DataAccess.DLL.
LOG: Attempting download of new URL
file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/Temporary ASP.NET Files/vendorapplication/8cc1d433/257b7ed7/Oracle.DataAccess/Oracle.DataAccess.DLL.
LOG: Attempting download of new URL
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
[BadImageFormatException: Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program
with an incorrect format.]
System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark&
stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
System.Reflection.Assembly.Load(String assemblyString) +35
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +190
[ConfigurationErrorsException: Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load
a program with an incorrect format.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +11211672
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +232
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +210
System.Web.Compilation.WebDirectoryBatchCompiler..ctor(VirtualDirectory vdir) +191
System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors) +54
System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +295
System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean
System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean
allowCrossApp, Boolean allowBuildInPrecompile) +116
System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean
System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context,
Boolean allowCrossApp, Boolean noAssert) +52
System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +263
Version Information: Microsoft .NET Framework
Version:2.0.50727.4952; ASP.NET Version:2.0.50727.4955
Jan 29, 2011 10:35 AM|Lateef045|LINK
Did you copy all the Dlls after you build your application in Visual studio to your bin folder in IIS virtual directory?
Jan 29, 2011 09:43 PM|Lannie|LINK
IIS Server needs ODP.NET Oracle Client installed, same version as that used in production database.
Jan 30, 2011 05:04 PM|susan8|LINK
The oracle is installed. Like i said it works using visual studio development server. It is not working using IIS server(it is also on my local development machine, so it local IIS server,not production).
Jan 30, 2011 05:05 PM|susan8|LINK
It is on the same server(on my development machine). there is no need to copy. I mean it works using the visual studio development server, it was not working on the IIS server on the same machine.
Jan 30, 2011 05:22 PM|Lannie|LINK
Show us you web.config CONNECTION STRING to Oracle.
If using Windows 7, Windows 2003/2008, did you make an INBOUND firewall rule for Oracle listener PORT (default port is 1521)?
Jan 30, 2011 05:31 PM|Lannie|LINK
Give us some specific information.
What is your operating system?
Are you working in 32-bit or 64-bit?
What version of IIS are you using?
What version of Oracle database is installed on the machine?
What version of ODP.NET did you install?
Are you developing in ASP.NET 2.0/3.5 or ASP.NET 4.0?
That makes a difference because oracle uses different versions of oracle.dataaccess.dll for each version of ASP.NET.
Go to your database home direction > ODP.NET > bin and copy the correct version of oracle.dataaccess.dll
to your ASP.NET project BIN folder, and redo you references to be local to the BIN folder of project
and not the GAC.
Jan 31, 2011 04:14 AM|susan8|LINK
I am using localhost.
Jan 31, 2011 04:19 AM|susan8|LINK
what is INBOUND firewall rule, i am using
windows 7,64 bit, IIS7, vs2008(framework 2),oracle 11g. The odd thing is everything works fine using visual studio development server, so all the oracle data access should be no problem. what is the difference between using visual studio development server
and iis server?
Jan 31, 2011 04:20 AM|susan8|LINK
what do you mean by "make an INBOUND firewall rule for Oracle listener PORT "? Thanks.
Feb 01, 2011 02:45 AM|Lannie|LINK
Okay, I have some recommendations. The key to success with Oracle in DEV environment is proper installation on a static IP address, resolving firewall issues, and having the right clients installed for IIS, VStudio, and other applications, like TOAD for
1. Oracle works best on a static (never changes) IP address as per the Windows installation guide and personal experience, and Oracle recommends using the Microsoft Loopback Adapter, a virtual LAN adapter, for hosting Oracle in your development environment.
In that case, the virtual static IP becomes something you choose, like 192.168.50.50, a local address, and the localhost 127.0.0.1 becomes the DNS address (Gateway Address not required). The advantage of this setup is if anything changes on your wired or
wireless LAN adapters, Oracle is unaffected.
http://download.oracle.com/docs/cd/E11882_01/install.112/e16773.pdf is the Windows Installation Guide for Oracle.
You would have to uninstall Oracle, reboot, remove Oracle Key from Registry HKEYLOCAMACHINE > Software > Oracle key, install the Loopback Adapter, temporarily disable you wired and wireless LAN adapters, reinstall Oracle on the Loopback Adapter static IP
only, complete the additional Windows Oracle installation tasks.
2. Since you are running 64-bit OS and likely installed the 64-bit database, after getting Oracle reinstalled on a static IP on the Loopback Adapter, I would also download the ODP.NET 32-bit with Client and VS Tools, and install in another Oracle Home directory,
so yes, you have both 64-bit and 32-bit Oracle clients available. With the 32-bit Oracle client running, many problems with VS Tools, TOAD, IIS go away.
3. Windows 7 has a two-way software firewall. You can create INBOUND and OUTBOUND firewall rules to deny or allow traffic on various TCP ports. When Oracle is installed on the Loopback Adapter, it is listening on default TCP port 1521 for traffic from
your wired LAN adapter to the virtual LAN Loopback Adapter. So, you can create a firewall rule to allow TCP 1521 port traffic between these IP addresses or ranges of IP addresses. As I recall, this issue is discussed in the Oracle Install Guide for windows
I had some notes on installing Oracle on Windows, but at the moment, cannot find the TEXT file.
Jul 25, 2011 08:46 AM|osmanbinali|LINK
I have the similar problems deploying on test server
my configurations reads are follows:
Dec 20, 2011 10:02 AM|NamelessParanoia|LINK
I've just had to solve this issue. Mine turned out to be that the app pool was set to "Enable 32 bit applications", meaning it was running as a 32 bit app and couldn't load the installed 64 bit dll.