BadImageFormatException for a 64-bit ASP MVC web application

Updated on Thursday, September 30, 2021

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 your comment...

Related Posts

You Might Also Like

(All Code Posts)

(Published to the Fediverse as: BadImageFormatException for a 64-bit ASP MVC web application #code #asp.net #microsoft #32-bit #64-bit Visual Studio will try to use the 32-bit version of IIS Express to launch a 64-bit web application. Here's how to fix this problem by telling Visual Studio to use 64-bit IIS Express instead. )

Comments

Ehsan Haghpanah

really thanks for your precious help. your post is a life saver

Tolga

That was a life saver! I would have never found that on my own. Thank you very much!

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.

Newsletter

Related

Crushing PNGs in .NET