ASP.NET: System.BadImageFormatException

If you are running on Vista x64

System.BadImageFormatException

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