This website may use cookies. More info. That's Fine x
Welcome Login

System.BadImageFormatException: Could not load file or assembly problem


Asp.Net

When you get a "System.BadImageFormatException: Could not load file or assembly" error on your website (Yellow page of death, which occurs when an asp.net web application encounters a problem and crashes), this usually relates to a x86/x64 architechure problem.

Eg: when you run a 32 bit library (in example, GDBusiness assembly is set to x86), and publish it on a 64 bit web platform (Windows 2008 64bit web server).

To fix:

 

Steps:

1. Open configuration manager in Visual Studio: Goto > Build > Configuration Manager.

Or open in Visual Studo shortcuts: solutions configurations:

vs-assemblyexception2

 

2. Make sure assembly is set to 'Any CPU', or an appropriate platform.  In example, assembly is GDBusiness.

vs-assemblyexception1

 

3. Build and Publish solution

4. Copy published files to web servers.


Created on: Friday, September 9, 2011 by Andrew Sin