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

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

 

The above error occurs after you set a project ( a web project or one its dependencies) to target x64 .

The fix is simple, but difficult to find. Select your web project, click ‘Tools | Options ‘, then Select ‘Projects And Solutions | Web Projects’ and then check the box for ‘Use the 64 bit version of IIS Express for web sites and projects’