I have a ASP.NET 3.5 application that includes a 32-bit DLL. It works fine (and has for years) on Windows XP, 7 and 10. I am adding support for Windows 2012, 2012 R2 and 2016. It works on 2016, but does not work on 2012 R2.
At the first call to the DLL, the following error occurs:
BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
The same build and install script is used for all OS's tested. Each OS is on a VM on the same machine, so the hardware for all OS's is identical. For each OS:
I've tried all the suggestions in the posts I've found on this problem, but nothing works. Any ideas?
Double check in Task Manager that your W3WP.exe process for the application is running 32-bit and that it is in fact Default App Pool that is trying to load the DLL. This error message almost certainly means 64-bit process trying to load 32-bit DLL.
User contributions licensed under CC BY-SA 3.0