IIS7 failed to load the file or assembly "XXX.XXX" or one of its dependencies. Trying to load a solution with a malformed program

  
                  

Deploying a .NET Program On the IIS7 server, the following message appears:

Description: An unhandled exception occurred during the execution of the current web request. Check the stack trace information for details about the error and the source of the error in the code.

Exception Details: System.BadImageFormatException: Failed to load file or assembly 'XXX' or one of its dependencies. Trying to load program with an incorrect format.

Source Error:


An unhandled exception was generated during the execution of the current web request. The following exception stack trace information can be used to determine information about the cause of the anomaly and where it occurred.

Assembly Load Tracking: The following information helps determine why the assembly "XXX" could not be loaded.


WARNING: Assembly binding logging is turned off. To enable assembly binding failure logging, set the registry value [HKLM\\Software\\Microsoft\\Fusion!EnableLog] (DWORD) to 1. Note: There will be some performance penalty associated with assembly binding failure logging. To turn off this feature, please remove the registry value [HKLM\\Software\\Microsoft\\Fusion!EnableLog
Solution:
Generate the application as the target platform: Any CPU;
Test environment is notebook win7 64 Bit, put iis application pool -- advanced settings -- enable 32-bit applications: true

Copyright © Windows knowledge All Rights Reserved