April 29, 2011
The typical cause of the ASP.Net "System.BadImageFormatException" exception is:
- You are referencing a 32-bit library.
- Your .NET application is compiled with the "Platform target" of either "Any CPU" or "x64".
- You attempt to run/deploy the app on/to a 64-bit OS.
- The application runs as a 64-bit app, but tries to load the 32-bit library.
The solution is to go to IIS Manager and click on "Advanced Settings" for the app pool running your website. Set "Enable 32-Bit Applications" to True.