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 reflection
The previous article referred to the DLL reference problem, the main point is that if you used the reflection in the program, the reflection creates the object's DLL must be placed in the Web application's Bin directory. Today, a similar problem was encountered, when the MVC3 application, published to IIS, reported: "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. “。 The reason is simple, because when I sent the project, Oracle provided ASP. NET access to the Oralcle database this Oracle.DataAccess.dll local copy is not set to True (the reference is found in the project reference, and the right-click property has this " Local Replication "). It is not automatically copied to the bin directory when it is released. Thus, the error that failed to load is shown. All right! In that case, I would either refer to the property in the project or simply copy the DLL to the bin directory that was published on the server. After I copied it, the problem came back, or the mob failed to load a reference. Then I think I IIS is located on the server is 64, and my odp.net is loaded 32. So the corresponding Oracle.DataAccess.dll should also be 32 bits, which involves the configuration of IIS.
DLL has, 32-bit, the system is 64-bit. This has a setting in IIS as follows:

Let's take a look at which application pool the project uses:


Then go to the application pool to configure


Set enable 32-bit application to True

OK, fix it. Then browse everything normal.

Reprint: Joey's Blog

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.

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.

Related Article

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.