I thought I would post this answer out there to hopefully save some people the hassle I just had in trying to troubleshoot a "Could not load file or assembly" error, for in my particular case I have not seen the same solution posted out there yet.
My case is this - I was getting an error trying to open a locally installed web service. The "warning" (though it really should show as an error, imho) showing up in my event log was this:
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.
The "incorrect format" part usually has to do with having an x86 version of the DLL in question rather than an x64 version, and SQLite is one of those where it has a different library for each platform. I had installed the x64 version of the service, so I checked that it was also installing the x64 version of the SQLite DLL, which it was. I was perplexed. Everything I was Googling made me think that somehow it was loading up the 32-bit version somehow. Finally I had my aha moment.
A couple days back, while trying to build and run this same service, the configuration was such that only the 32-bit version of the service would build. So, at the time, I changed the Application Pool that it ran under to allow 32-bit applications. That changes the Application Pool to use WoW64, the Windows 32-bit emulator. So, the Application Pool thought it needed the x86 SQLite DLL. Once I changed the Application Pool to not allow 32-bit applications everything ran smoothly once again.
No comments:
Post a Comment