blog.mha.dk
The on-line blog of Michael Holm Andersen

Could not load file or assembly 'name' or one of its dependencies (VS2010, ASP.NET 4.0 beta 1)

Thursday, 1 October 2009 14:46 by mha

Setting up my VS2010 Beta 1 environment and a website running against IIS 7, I encountered this error:

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

After a bit of research it turns out that this is caused by the fact that I’m running a 64bit version of Vista, my DLL’s is compiled to x86 .. and the IIS applicationpool does not allow execution of 32bit (x86) code!!

My DLL was (by default) compiled to x86 (32 bit) code by VS2010:

VS2010buildsettings

.. and my ASP.NET 4.0 (integrated mode) ApplicationPool did not allow 32bit code to execute:

IIS7aspnet4_32bit

(Note that in the above screenshot I’ve turned on the ability to run 32bit code within the ApplicationPool)

I could of course have changed the DLL to compile x64 code instead.

Comments are closed