Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I developed web application (.Net 4.0). On x-64 bit OS it was working with local machine fine but it was showing problem when I was running it with VPS(host machine) the exception was - "System.BadImageFormatException: Could not load file or assembly 'WebApplication' or one of its dependencies. An attempt was made to load a program with an incorrect format".

To remove that problem I changed my application 64 to 86 but still I am facing same problem can somebody help me.

How can I resolve that problem.
Posted
Updated 6-Dec-11 20:01pm
v2

You will get a bad image format exception if your DLL's don't match the calling EXE's 32/64 bit format or you are trying to run a .net4 DLL from a .net2 EXE.

You will also get these errors if you have used an obfuscator (which mangles the PE format).

Try checking your web host is using .net4 and not .net2.
 
Share this answer
 
This exception is generally thrown when the file image of a dynamic link library (DLL) or an executable program is invalid.

Cause of BadImageFormatException[^]
This may occur on a 64 bit machine running .net 2.0. DotImage assemblies have unmanaged code in them, so they always need to be run in the 32 bit runtime. "BadImageFormat" is referring to the format of the dll, it means .net tried to load a 32bit only assembly into the 64 bit runtime.

Read the thread from given link
http://support.leadtools.com/CS/forums/32979/ShowPost.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900