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.

Posted by Om Talsania on Geeks with Blogs See other posts from Geeks with Blogs or by Om Talsania
Published on Sun, 02 Sep 2012 12:36:51 GMT Indexed on 2012/09/02 15:39 UTC
Read the original article Hit count: 277

Filed under:

Problem Description:

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.

Likely to be reproduced when:

You will usually encounter this problem when you have downloaded a sample application that is a 32-bit application targeted for ASP.NET 2.0 or 3.5, and you have IIS7 on a 64-bit OS running .NET 4.0, because the default setting for running 32-bit application on IIS7 with 64-bit OS is false.

Resolution:

1. Go to IIS Management Console
Start -> Administration Tools -> Internet Information Services (IIS) Manager

2. Expand your server in the left pane and go to Application Pools

3. Right click to select ‘Add Application Pool’ 

4. Create anew AppPool. I have named it ASP.NET v2.0 AppPool (32-bit) and selected .NET Framework v2.0.50727 because I intend to run my ASP.NET 3.5 application on it.
clip_image003

5. Now right click the newly created AppPool and select Advanced Settings

6. Change the property “Enable 32-Bit Applications” from False to True 


7. Now select your actual web application from the left panel. Right click the web application, and go to Manage Application -> Advanced Settings 


8. Change the Property “Application Pool” to your newly created AppPool. 


And… the error is gone…

© Geeks with Blogs or respective owner