Wednesday, April 1, 2009

BadImageFormatException in IIS 7.0 on 64-bit Windows 2008

When hosting a WCF service in IIS 7 on my 64-bit Windows 2008 machine I got the following error:

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

To resolve this I had to set the "Enable 32-Bit Applications" ([enable32BitAppOnWin64]) to true on the applicable application pool.

See also:


I've also run into the same issue with the Application Pool for a Sitecore CMS 6 install.

Server Error in '/' Application.

Could not load file or assembly 'System.Data.SQLite, Version=1.0.48.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' 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, Version=1.0.48.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. An attempt was made to load a program with an incorrect format.