tags:

views:

148

answers:

2

Hi

I am trying to deploy an asp .net MVC app onto II7 and getting the following error:

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

The server has .net 3.5 SP1 and I tried including the dll in the website bin with no luck!

I noticed in the GAC on the server there are 2 System.Web 2.0 one with the processor architecture x86 and another with AMD64 (server is Intel XEON), could this be causing this error?

Thanks

SOLUTION: Change the build platform target to x64, doh!

+4  A: 

There are supposed to be two in the GAC. One is 32 bit and the other is 64 bit. It sounds, from the error, that you are trying to load a 64-bit dll into a 32-bit process. What bitness is the program compiled as? What bitness is the server OS?

codekaizen
+1 for insight and "bitness"
Adam Robinson
the server is 64 bit! how do I check the program bitness?
Rigobert Song
Rigobert: Check the build settings in Visual Studio, and if it's being built via a command line, check those settings. Finally, check to make sure you're not running IIS itself as 32-bit.
John Rudy
+1 on double checking IIS. Make sure you check the Application Pool, as that is what is either 32 or 64 bit. You can force it to be one or the other in the AppPool properties.
codekaizen
A: 

Got the same error on a x64 IIS7. I changed the Application Pool setting "Enable 32-Bit Applications" to true.

Meixger