Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / SQL

An attempt was made to load a program with an incorrect format sqlite

0.00/5 (No votes)
20 Feb 2013CPOL1 min read 21.7K  
An attempt was made to load a program with an incorrect format sqlite

Image 1

I was loading an ASP.NET small application on IIS7 which used SQLite as back-end and I was getting the error "Could not load file or assembly ‘System.Data.SQLite, Version=1.0.61.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139′ or one of its dependencies. An attempt was made to load a program with an incorrect format.".

Since it was a compiled application and I didn’t have the source code, I was not able to go through the source code and troubleshoot the application. After searching and working for few minutes, I found that the application was developed for 32-bit operating system and I was working on a 64-bit operating system.

Also, I found that System.Data.SQLite.dll is a mixed assembly file and it contains both native and managed code and one System.Data.SQLite.dll file is either 32-bit or 64-bit and it can not be both. And if a 32-bit application runs on IIS7 and/or 64-bit operating system, the same error will occur.

I solve this problem by following steps below:

Step 1

 Image 2

Go to IIS7 and open Application Pools

Step 2

Right click on the pool which is associated with website or application in IIS and select Advanced Settings

 Image 3

IIS7 Advanced Setting

Step 3

Set "Enabled 32-Bit Application" to True and press OK

IIS7 Advnaced Settings - Enbale 32-Bit Applications
IIS7 Advnaced Settings – Enbale 32-Bit Applications

Step 4

Restart the IIS (Optional) and check the application.

Step 5

I hope above steps solve your problem.

Any comments or suggestion are most welcome.

The post An attempt was made to load a program with an incorrect format sqlite appeared first on Recent Solutions.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)