System.badimageformatexception: Failed to load file or assembly "oracle.dataaccess" or one of its dependencies. An attempt was made to load a program that is not properly formatted.

Source: Internet
Author: User
Tags httpcontext stack trace

Native environment: Win7 32-bit, development tool: VS2008

When you update webservices today , such as:

The following error was reported:

When opening the asmx file on the server side , the error message is as follows:

Server error in "/" application. Failed to load file or assembly "oracle.dataaccess" or one of its dependencies. An attempt was made to load a program that is not properly formatted. Description:  An unhandled exception occurred during the execution of the current WEB request. Check the stack trace information For more information about the error and the source of the error in your code.   Exception Details:  system.badimageformatexception: Failed to load file or assembly "oracle.dataaccess" or one of its dependencies. An attempt was made to load a program that is not properly formatted. Source Error:  An unhandled exception was generated during the execution of the current WEB request. You can use the following exception stack trace information to determine information about the cause of the exception and where it occurred. Assembly load Tracking:  The following information to help determine why the assembly "oracle.dataaccess" could not be loaded. Warning: Assembly binding logging is turned off. To enable assembly binding failure logging, set the registry value [hklm\software\microsoft\fusion! Enablelog] (DWORD) is set to 1. Note there will be some performance loss associated with the assembly binding failure logging. To turn off this feature, remove the registry value [hklm\software\microsoft\fusion! Enablelog]. Stack trace:  [badimageformatexception: Failed to load file or assembly "oracle.dataaccess" or one of its dependencies. An attempt was made to load a program that is not properly formatted. ] System.reflection.assembly._nload (AssemblyName fileName, String codeBase, Evidence assemblysecurity, Assembly   Locationhint, stackcrawlmark& Stackmark, Boolean throwOnFileNotFound, Boolean forintrospection) +0 System.Reflection.Assembly.nLoad (AssemblyName fileName, String codeBase, Evidence assemblysecurity, Assembly Locationhint, stackcrawlmark& Stackmark, BOolean throwOnFileNotFound, Boolean forintrospection) +43 System.Reflection.Assembly.InternalLoad (AssemblyName   AssemblyRef, Evidence assemblysecurity, stackcrawlmark& stackmark, Boolean forintrospection) +127 System.Reflection.Assembly.InternalLoad (String assemblystring, Evidence assemblysecurity, stackcrawlmark& Stackmark, Boolean forintrospection) +142 System.Reflection.Assembly.Load (String assemblystring) +28 System.Web.Confi Guration. Compilationsection.loadassemblyhelper (String AssemblyName, Boolean stardirective) +46[configurationerrorsexception : Failed to load file or assembly "oracle.dataaccess" or one of its dependencies. An attempt was made to load a program that is not properly formatted.   ] System.Web.Configuration.CompilationSection.LoadAssemblyHelper (String AssemblyName, Boolean stardirective) +613   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory (+203)   System.Web.Configuration.CompilationSection.LoadAssembly (AssemblyInfo ai) +105 System.Web.Compilation.BuildManager.GetReferencedAssemblies (compilationsection COmpconfig) +178 System.Web.Compilation.WebDirectoryBatchCompiler. ctor (VirtualDirectory vdir) +163 System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal ( VirtualDirectory VDir, Boolean ignoreerrors) +53 System.Web.Compilation.BuildManager.BatchCompileWebDirectory (   VirtualDirectory VDir, virtualpath virtualdir, Boolean ignoreerrors) +175   System.Web.Compilation.BuildManager.CompileWebFile (virtualpath virtualpath) +86 System.Web.Compilation.BuildManager.GetVPathBuildResultInternal (VirtualPath virtualpath, Boolean Nobuild, Boolean   Allowcrossapp, Boolean allowbuildinprecompile) +261 System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert (HttpContext context, virtualpath virtualpath,   Boolean Nobuild, Boolean Allowcrossapp, Boolean allowbuildinprecompile) +101 System.Web.Compilation.BuildManager.GetVPathBuildResult (HttpContext context, virtualpath virtualpath, Boolean Nobuild, Boolean Allowcrossapp, Boolean allowbuildinprecompile) +83 System.Web.Compilation.   Buildmanager.getvpathbuildresult (HttpContext context, virtualpath virtualpath) +10   System.Web.UI.WebServiceParser.GetCompiledType (String Inputfile, HttpContext context) +43 System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler (HttpContext context, string verb, string url, String filePath) +180 System.Web.Script.Services.ScriptHandlerFactory.GetHandler (HttpContext context, string RequestType, string URL, string pathtranslated) +47 System.Web.HttpApplication.MapHttpHandler (HttpContext context, String RequestType, VirtualPath path, string pathtranslated, Boolean useappconfig) +193 System.Web.MapHandlerExecutionS Tep. System.Web.HttpApplication.IExecutionStep.Execute () +93 System.Web.HttpApplication.ExecuteStep (IExecutionStep Step, boolean& completedsynchronously) + 155 release information:  microsoft. NET Framework Version: 2.0.50727.5477; asp: 2.0.50727.5483 <span style= "font-family: Song body; Background-color:rgb (255, 255, 255); " >     </span>

Reason:

The version of oracle.dataaccess in the code is different from the version of the native version of Oracle (server side or client), for example: The version used in this code is:ten, and my native installation is one by one. Although oracle.dataaccess is not used in the client and service references, this DLLis used in the Zjgl_publicserver project, such as:


Workaround:

remove this reference from the Zjgl_publicserver project and replace the oracle.dataaccess version of the DLL (search Oracle.DataAccess.dllin the installation directory) , done.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.