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.