DevelopMENTAL Madness

Tuesday, May 26, 2009

ASP.NET: System.BadImageFormatException

If you are running IIS 7 on Vista x64 you may get this error:

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

By default IIS 7 won’t load x86 (32 bit) assemblies, make sure you set your application pool’s “Enable 32-Bit Applications” setting to “True”.

Internet Information Services (IIS) Manager > Application Pools > {Your App Pool} > Advanced Settings > Enable 32-Bit Applications

If this still doesn’t work. Try changing your build configuration platform setting for each project in your solution from “Any CPU” to “x86” and then rebuilding your solution.

Right-click Visual Studio Project File in Solution Explorer > Properties > Build > Platform

Labels: , , ,

Links to this post:

Create a Link

<< Home