locked
Custom Server controls shows "Incorrect format error" RRS feed

  • Question

  • User1550671741 posted

    Hello,

    I have an solutin which includes the following configuration

    Dev Machine - Win7 64bit

    ProjectA which uses Oracle.DataAccess.dll(2.112.3.0 | 64bit) CPU Target is "64bit" under Build tab.

    ProjectB references ProjectA and uses Oracle.web.dll(2.112.3.0 | 64bit) CPU Target is "Any CPU"under Build tab.

    Have 3 versions of oracle client installed but they all seem to be 32bit according to this http://www.dba-oracle.com/t_client_32_bit_or_64_bit.htm

    ProjectB has a lot of custom control pages but all of them show the following error.

    xxx.ascx ASP.NET Runtime Error: Could not load file or assembtly 'ProjectA' or one of its dependencies. An attempt was made to load a program with incorrect format.

    I have been reading all posts in regards to this and have tried cleaning my asp.net temp folders, giving full permissions to it for "users" group and even as last resort "Everyone".

    I need to do some development and the custom control pages would not update the designer file with new control info so I cant access them code behind...

    I used fusion log and this is what it said in regards to Oracle.DataAccess(I think this dll might be the culprit):

    *** Assembly Binder Log Entry  (09/04/2014 @ 5:41:50 PM) ***
    
    The operation failed.
    Bind result: hr = 0x80070002. The system cannot find the file specified.
    
    Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
    Running under executable  c:\windows\system32\inetsrv\w3wp.exe
    --- A detailed error log follows. 
    
    === Pre-bind state information ===
    LOG: User = EPCOR\srv_spappwcssdev
    LOG: DisplayName = Oracle.DataAccess, Version=2.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342
     (Fully-specified)
    LOG: Appbase = file:///c:/windows/system32/inetsrv/
    LOG: Initial PrivatePath = NULL
    LOG: Dynamic Base = NULL
    LOG: Cache Base = NULL
    LOG: AppName = w3wp.exe
    Calling assembly : (Unknown).
    ===
    LOG: This bind starts in default load context.
    LOG: No application configuration file found.
    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: Post-policy reference: Oracle.DataAccess, Version=2.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342
    LOG: GAC Lookup was unsuccessful.
    LOG: Attempting download of new URL file:///c:/windows/system32/inetsrv/Oracle.DataAccess.DLL.
    LOG: Attempting download of new URL file:///c:/windows/system32/inetsrv/Oracle.DataAccess/Oracle.DataAccess.DLL.
    LOG: Attempting download of new URL file:///c:/windows/system32/inetsrv/Oracle.DataAccess.EXE.
    LOG: Attempting download of new URL file:///c:/windows/system32/inetsrv/Oracle.DataAccess/Oracle.DataAccess.EXE.
    LOG: All probing URLs attempted and failed.

    I have run out of options on how to get rid of this error. Any input would be appreciated.

    Thank you

    Thursday, April 10, 2014 11:10 AM

Answers

  • User1918509225 posted

    Hi rkz,

    About your problem,please try the steps below:

    1 In Visual Studio, Right click on your project,choose the properties,choose the Build tab

    2 Under Platform Target ,select under Platform Target select x86 (or more generally the architecture to match with the library you are linking to).

    3 Restart your visual studio.

     

    Hope it can help you.

    Best Regards,

    Kevin Shen.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 14, 2014 2:25 AM

All replies

  • User465171450 posted

    Usually this error "An attempt was made to load a program with incorrect format" comes from the app pool being configured for 64 bit only. If there's a 32-bit dll in there, even if your build target is 64-bit or any cpu, you'll get this error.

    Go into the IIS manager, find the application location in IIS, select the "Basic Settings" from the right-hand side of the screen under "Actions" | "Edit Site". Look at the selected Application Pool. 

    Now go to the Application Pools tree in the IIS manager, find the application pool right click on the name to bring up the context menu. Select "Advanced Settings". In the section labelled "General" at the very top you'll see an option called "Enable 32-bit Applications". Set this to true. Hit Ok. You may want to start and re-start the application pool just to make sure it all works.

    Thursday, April 10, 2014 10:16 PM
  • User1550671741 posted

    Thanks for the prompt response. I have tried that but then it doesn't even build the application, currently I can build it, run it, etc.But its just these ProjectB control files are complaining about the incorrect format and updating the designer file. 

    Friday, April 11, 2014 11:13 AM
  • User1918509225 posted

    Hi rkz,

    About your problem,please try the steps below:

    1 In Visual Studio, Right click on your project,choose the properties,choose the Build tab

    2 Under Platform Target ,select under Platform Target select x86 (or more generally the architecture to match with the library you are linking to).

    3 Restart your visual studio.

     

    Hope it can help you.

    Best Regards,

    Kevin Shen.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 14, 2014 2:25 AM