Web application causes An attempt was made to load a program with an incorrect format error.

Problem:

When I attempt to start my asp.net web application running in IIS 8 I receive the following error:

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

Solution:

Enable 32-Bit Applications for the Application Pool running your application.

Explanation:

Start IIS and select your web applications virtual directory under Sites\Default Web Site. Select Basic Settings from the Actions pane.  Note the Application pool your application is using and click Cancel to close the dialog.  Select Application Pools from the Connections pane.  Right click on the application pool running your web application and select Advanced Settings from the context menu.  Change Enable 32-bit Applications from False to True.

Comments are closed