BadImageFormatException 0x8007000B only on Windows Server 2012 R2

0

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:

  • OS is fully updated.
  • vcredist 9.0 (x86) is installed as part of the installation.
  • IIS DefaulatAppPool has 32-bit applications enabled.

I've tried all the suggestions in the posts I've found on this problem, but nothing works. Any ideas?

iis
windows-server-2012
asked on Stack Overflow Apr 16, 2019 by Wayne Goode

1 Answer

1

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.

answered on Stack Overflow Apr 16, 2019 by Rich-Lang

User contributions licensed under CC BY-SA 3.0