Could not load file or assembly … An attempt was made to load a program with an incorrect format (System.BadImageFormatException)

There are times when you might get the following error when running the application from Visual Studio or opening your application page in the browser.

Could not load file or assembly … An attempt was made to load a program with an incorrect format (System.BadImageFormatException)

I received this error recently when trying to deploy the application in the IIS and accessing the page from the browser.

One of the primary reason that you might get this error could be the 32-bit and 64-bit dll support. If you are receiving this error on deployment , ensure that your Application pool is set to support 32-bit libraries in IIS.

%d