I Thought He Came With You is Robert Ellison’s blog about software, marketing, politics, photography and time lapse.

BadImageFormatException for a 64-bit ASP MVC web application

System.BadImageFormatException for a 64-bit web application in IIS Express

I converted an ASP.NET MVC web application to 64-bit in order to use dlib and it immediately died with a System.BadImageFormatException (Could not load file or assembly 'xxx' or one of its dependencies. An attempt was made to load a program with an incorrect format.)

Assuming I must have a stray wrong-bittedness something lying around I spent way to long with the assembly binding log viewer (Fuslogvw.exe) trying to figure out what I had messed up. But eventually I realized that Visual Studio was launching a 32-bit version of IIS Express to debug a 64-bit web application.

To fix this select Options from the Tools menu, expand Projects and Solutions, choose Web Projects and then check Use the 64-bit version of IIS Express for  web sites and projects. Problem solved.

(Probably shouldn't have this component in the web application - the plan longer term is to move it to an asynchronous process somewhere instead.)

Add Comment

All comments are moderated. Your email address is used to display a Gravatar and optionally for notification of new comments and to sign up for the newsletter.