3 Replies Latest reply: Dec 6, 2012 3:23 PM by 978415 RSS

    Oracle.DataAccess Error on IIS

    ryn_90
      I am having the below error. At first, I did not have this problem (even though the application was connecting with the database), but after a couple of days of further development I encountered this error when deploying. What should I do to resolve this?

      I would not like to copy the local dll since I would like to use the Oracle drivers on the server.


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

      Exception Details: 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.

      Source Error:

      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 = NT AUTHORITY\NETWORK SERVICE
      LOG: DisplayName = Oracle.DataAccess
      (Partial)
      WRN: Partial binding information was supplied for an assembly:
      WRN: Assembly Name: Oracle.DataAccess | Domain ID: 10
      WRN: A partial bind occurs when only part of the assembly display name is provided.
      WRN: This might result in the binder loading an incorrect assembly.
      WRN: It is recommended to provide a fully specified textual identity for the assembly,
      WRN: that consists of the simple name, version, culture, and public key token.
      WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
      LOG: Appbase = file:///E:/inetpub/wwwroot/SAAM/
      LOG: Initial PrivatePath = E:\inetpub\wwwroot\SAAM\bin
      Calling assembly : (Unknown).
      ===
      LOG: This bind starts in default load context.
      LOG: Using application configuration file: E:\inetpub\wwwroot\SAAM\web.config
      LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
      LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\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/v4.0.30319/Temporary ASP.NET Files/saam/27fd3199/21ab537d/Oracle.DataAccess.DLL.
      LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/saam/27fd3199/21ab537d/Oracle.DataAccess/Oracle.DataAccess.DLL.
      LOG: Attempting download of new URL file:///E:/inetpub/wwwroot/SAAM/bin/Oracle.DataAccess.DLL.
      ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.



      Stack Trace:


      [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.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
      System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) +567
      System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +192
      System.Reflection.Assembly.Load(String assemblyString) +35
      System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +118

      [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) +11396867
      System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +484
      System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +127
      System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +334
      System.Web.Compilation.BuildManager.CallPreStartInitMethods() +280
      System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1087

      [HttpException (0x80004005): 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.HttpRuntime.FirstRequestInit(HttpContext context) +11529072
      System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
      System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4784373




      --------------------------------------------------------------------------------
      Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
        • 1. Re: Oracle.DataAccess Error on IIS
          gdarling - oracle
          System.BadImageFormatException occurs when you try to load a 32 bit assembly into a 64 bit process, or vice versa.

          You'll want to confirm what you have compile target set to in the build (ie, x86, x64, ANYCPU), and what bit-ness of ODP.NET and Oracle client you have installed on the web server. It looks like the app is running as 64 bit, do you have 64 bit Oracle client installed?

          Greg
          • 2. Re: Oracle.DataAccess Error on IIS
            ryn_90
            I have partially solved that issue, and I have this one now:

            Server Error in '/SAAM' Application.
            --------------------------------------------------------------------------------

            Could not load file or assembly 'Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.
            Description: 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.

            Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.

            Source Error:

            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, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342' could not be loaded.


            === Pre-bind state information ===
            LOG: User = NT AUTHORITY\NETWORK SERVICE
            LOG: DisplayName = Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342
            (Fully-specified)
            LOG: Appbase = file:///E:/inetpub/wwwroot/SAAM/
            LOG: Initial PrivatePath = E:\inetpub\wwwroot\SAAM\bin
            Calling assembly : DatabaseConnection, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
            ===
            LOG: This bind starts in default load context.
            LOG: Using application configuration file: E:\inetpub\wwwroot\SAAM\web.config
            LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
            LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
            LOG: Publisher policy file is found at C:\Windows\Microsoft.Net\assembly\GAC_64\Policy.4.112.Oracle.DataAccess\v4.0_4.112.2.0__89b483f429c47342\Policy.4.112.Oracle.DataAccess.config.
            LOG: Publisher policy file redirect is found: 4.112.3.0 redirected to 4.112.3.0.
            LOG: Post-policy reference: Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342
            LOG: The same bind was seen before, and was failed with hr = 0x80070002.



            Stack Trace:


            [FileNotFoundException: Could not load file or assembly 'Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.]
            DatabaseConnection.DatabaseAdapter..cctor() in C:\Documents and Settings\rsammut\My Documents\FCR\WP0001\Sources\DatabaseConnection\DatabaseAdapter.cs:24

            [TypeInitializationException: The type initializer for 'DatabaseConnection.DatabaseAdapter' threw an exception.]
            DatabaseConnection.DatabaseAdapter.GetInstance() in C:\Documents and Settings\rsammut\My Documents\FCR\WP0001\Sources\DatabaseConnection\DatabaseAdapter.cs:60
            SAA.Database_Layer.DB_ExceptionLog.GetAuditIdNextVal() in C:\Documents and Settings\rsammut\My Documents\Visual Studio 2010\Projects\SAA\SAA\Database Layer\DB_ExceptionLog.cs:22
            SAA.Business_Layer.SaaUtilities.GetExceptionIdNextVal() in C:\Documents and Settings\rsammut\My Documents\Visual Studio 2010\Projects\SAA\SAA\Business Layer\SaaUtilities.cs:17
            SAA._Default.Page_Load(Object sender, EventArgs eA) in C:\Documents and Settings\rsammut\My Documents\Visual Studio 2010\Projects\SAA\SAA\Default.aspx.cs:56
            System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
            System.Web.UI.Control.LoadRecursive() +71
            System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3048




            --------------------------------------------------------------------------------
            Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
            • 3. Re: Oracle.DataAccess Error on IIS
              978415
              how did you partially solve the issue?