How to use Process Monitor to determine which DLL is causing a BadImageFormatException

6.4k Views Asked by At

I have a large web application, which is supposed to run in a 64 bit process. However, when I set "Enable 32-bit Applications" to False on my App Pool, I get the following error trying to run the app in IE:

is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)

The application name at he beginning of the error message is missing, i.e. I have not lost it during copy and paste.

I have been advised to use Process Monitor to determine which application/DLL load is actually causing the error, but I have no idea where to start with this. Could somebody please advise?

EDIT: I have tried filtering Process Monitor on only w3wp.exe and only file system and process events, but simply attempting a navigate to the root URL yields 34,012 events.

2

There are 2 best solutions below

3
On BEST ANSWER

Create a console application that is built to be x64 only and use it to dynamically load all the referenced dll's one by one with console output between loads. When the console application fails to load one of the dll's, you'll know which one it is.

1
On

I'm assuming this is a ASP.Net application. Have you set your main web project(s) Platform Target to x86.

You can find the setting in Project Properties | Build | Platform target

Also do any of your projects reference any 3rd Party Libraries? If so do you know whether they are 32-bit or 64-bit dlls?