Tuesday, May 29, 2012

System.BadImageFormatException

Could not load file or assembly 'System.Data.SQLite' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.BadImageFormatException: Could not load file or assembly 'System.Data.SQLite' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Source Error:An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Data.SQLite' could not be loaded.


System.BadImageFormatException
System.BadImageFormatException: System.Data.SQLite


Resolution Steps:


1. Goto IIS (inetmgr)
2. Open Application Pools
3. Select the required pool
4. Click on 'Advanced Settings' on right hand side panal
5. Check the 'Enable 32-bit Applications' and set it to true (see below screenshot)
6. Restart the pool and browse your website

IIS Setting
Application Pool Advanced Settings