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=126.96.36.199, 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:
Go to IIS7 and open Application Pools
Right click on the pool which is associated with website or application in IIS and select Advanced Settings
IIS7 Advanced Setting
Set "Enabled 32-Bit Application" to True and press OK
Restart the IIS (Optional) and check the application.
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.