Last post Apr 14, 2014 02:25 AM by Kevin Shen - MSFT
Apr 10, 2014 11:10 AM|rkz|LINK
I have an solutin which includes the following configuration
Dev Machine - Win7 64bit
ProjectA which uses Oracle.DataAccess.dll(22.214.171.124 | 64bit) CPU Target is "64bit" under Build tab.
ProjectB references ProjectA and uses Oracle.web.dll(126.96.36.199 | 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
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=188.8.131.52, Culture=neutral, PublicKeyToken=89b483f429c47342
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=184.108.40.206, 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.
Apr 10, 2014 10:16 PM|markfitzme|LINK
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.
Apr 11, 2014 11:13 AM|rkz|LINK
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.
Apr 14, 2014 02:25 AM|Kevin Shen - MSFT|LINK
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.