Hello, a while ago I created a dll in c++ which uses the IHttpHandler Interface. I have been able to register and verify this module does what it is supposed to do on more than 8 virtual machines(IIS >> modules >> configure native modules >> register). I am using hyperv and those machines were created from a sysprepped image. I use the same dll file on all machines. The issue I am having is that it is not working properly on just one of those machines. As soon as I register the x64 module, when someone visits a websites, the application pool of the website goes down with message in the application log: "The Module DLL 'C:\the-name-of-the-dll.dll' could not be loaded due to a configuration problem. The current configuration only supports loading images built for a AMD64 processor architecture.". None of the application pools have "enable 32-bit applications" set to true. The OS is windows 2012R2 x64. I have built two versions of the dll - x32 and x64. I have no problems registering the x32 bit one. If I register the x64 bit dll and set "enable 32-bit applications" to true for an application pool, it works. I have also verified with process explorer that the w3wp processes run in x64 bit.
<add name="the-name-of-the-dll" image="C:\the-name-of-the-dll.dll" preCondition="bitness64" />
Below I am pasting the output from dumpbin /headers for both the x32 and x64 version of the dll. I have tried restarting the VM, restarting IIS, removing and readding the DLL, but nothing seems to work.
Microsoft (R) COFF/PE Dumper Version 14.00.24215.1
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file c:\the-name-of-the-dll.dll
PE signature found
File Type: DLL
FILE HEADER VALUES
8664 machine (x64)
7 number of sections
57DD5042 time date stamp Sat Sep 17 09:16:34 2016
0 file pointer to symbol table
0 number of symbols
F0 size of optional header
2022 characteristics
Executable
Application can handle large (>2GB) addresses
DLL
OPTIONAL HEADER VALUES
20B magic # (PE32+)
14.00 linker version
7800 size of code
5E00 size of initialized data
0 size of uninitialized data
78C8 entry point (00000001800078C8)
1000 base of code
180000000 image base (0000000180000000 to 0000000180011FFF)
1000 section alignment
200 file alignment
6.00 operating system version
0.00 image version
6.00 subsystem version
0 Win32 version
12000 size of image
400 size of headers
0 checksum
2 subsystem (Windows GUI)
160 DLL characteristics
High Entropy Virtual Addresses
Dynamic base
NX compatible
100000 size of stack reserve
1000 size of stack commit
100000 size of heap reserve
1000 size of heap commit
0 loader flags
10 number of directories
BDE0 [ 55] RVA [size] of Export Directory
BE38 [ A0] RVA [size] of Import Directory
10000 [ 1E0] RVA [size] of Resource Directory
E000 [ 84C] RVA [size] of Exception Directory
0 [ 0] RVA [size] of Certificates Directory
11000 [ 110] RVA [size] of Base Relocation Directory
A5D0 [ 70] RVA [size] of Debug Directory
0 [ 0] RVA [size] of Architecture Directory
0 [ 0] RVA [size] of Global Pointer Directory
0 [ 0] RVA [size] of Thread Storage Directory
A640 [ 94] RVA [size] of Load Configuration Directory
0 [ 0] RVA [size] of Bound Import Directory
9000 [ 2D0] RVA [size] of Import Address Table Directory
0 [ 0] RVA [size] of Delay Import Directory
0 [ 0] RVA [size] of COM Descriptor Directory
0 [ 0] RVA [size] of Reserved Directory
SECTION HEADER #1
.text name
7620 virtual size
1000 virtual address (0000000180001000 to 000000018000861F)
7800 size of raw data
400 file pointer to raw data (00000400 to 00007BFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
60000020 flags
Code
Execute Read
SECTION HEADER #2
.rdata name
3D48 virtual size
9000 virtual address (0000000180009000 to 000000018000CD47)
3E00 size of raw data
7C00 file pointer to raw data (00007C00 to 0000B9FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only
Debug Directories
Time Type Size RVA Pointer
-------- ------- -------- -------- --------
57DD5042 cv 4F 0000AF6C 9B6C Format: RSDS, {BFA18B91-5676-4435-832E-4DCAB9E8C7BC}, 1, H:\src\the-name-of-the-dll\x64\Release\the-name-of-the-dll.pdb
57DD5042 feat 14 0000AFBC 9BBC Counts: Pre-VC++ 11.00=0, C/C++=45, /GS=45, /sdl=0, guardN=31
57DD5042 coffgrp 2DC 0000AFD0 9BD0 4C544347 (LTCG)
57DD5042 iltcg 0 00000000 0
SECTION HEADER #3
.data name
E40 virtual size
D000 virtual address (000000018000D000 to 000000018000DE3F)
800 size of raw data
BA00 file pointer to raw data (0000BA00 to 0000C1FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
C0000040 flags
Initialized Data
Read Write
SECTION HEADER #4
.pdata name
84C virtual size
E000 virtual address (000000018000E000 to 000000018000E84B)
A00 size of raw data
C200 file pointer to raw data (0000C200 to 0000CBFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only
SECTION HEADER #5
.gfids name
34 virtual size
F000 virtual address (000000018000F000 to 000000018000F033)
200 size of raw data
CC00 file pointer to raw data (0000CC00 to 0000CDFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only
SECTION HEADER #6
.rsrc name
1E0 virtual size
10000 virtual address (0000000180010000 to 00000001800101DF)
200 size of raw data
CE00 file pointer to raw data (0000CE00 to 0000CFFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only
SECTION HEADER #7
.reloc name
110 virtual size
11000 virtual address (0000000180011000 to 000000018001110F)
200 size of raw data
D000 file pointer to raw data (0000D000 to 0000D1FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
42000040 flags
Initialized Data
Discardable
Read Only
Summary
1000 .data
1000 .gfids
1000 .pdata
4000 .rdata
1000 .reloc
1000 .rsrc
8000 .text
Microsoft (R) COFF/PE Dumper Version 14.00.24215.1
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file c:\the-name-of-the-dll.dll
PE signature found
File Type: DLL
FILE HEADER VALUES
14C machine (x86)
6 number of sections
5851907F time date stamp Wed Dec 14 12:33:35 2016
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
2102 characteristics
Executable
32 bit word machine
DLL
OPTIONAL HEADER VALUES
10B magic # (PE32)
14.00 linker version
6400 size of code
4400 size of initialized data
0 size of uninitialized data
689A entry point (1000689A)
1000 base of code
8000 base of data
10000000 image base (10000000 to 1000EFFF)
1000 section alignment
200 file alignment
6.00 operating system version
0.00 image version
6.00 subsystem version
0 Win32 version
F000 size of image
400 size of headers
0 checksum
2 subsystem (Windows GUI)
140 DLL characteristics
Dynamic base
NX compatible
100000 size of stack reserve
1000 size of stack commit
100000 size of heap reserve
1000 size of heap commit
0 loader flags
10 number of directories
9DB0 [ 58] RVA [size] of Export Directory
9E08 [ A0] RVA [size] of Import Directory
D000 [ 1E0] RVA [size] of Resource Directory
0 [ 0] RVA [size] of Exception Directory
0 [ 0] RVA [size] of Certificates Directory
E000 [ 7D4] RVA [size] of Base Relocation Directory
9070 [ 70] RVA [size] of Debug Directory
0 [ 0] RVA [size] of Architecture Directory
0 [ 0] RVA [size] of Global Pointer Directory
0 [ 0] RVA [size] of Thread Storage Directory
90E0 [ 40] RVA [size] of Load Configuration Directory
0 [ 0] RVA [size] of Bound Import Directory
8000 [ 158] RVA [size] of Import Address Table Directory
0 [ 0] RVA [size] of Delay Import Directory
0 [ 0] RVA [size] of COM Descriptor Directory
0 [ 0] RVA [size] of Reserved Directory
SECTION HEADER #1
.text name
6229 virtual size
1000 virtual address (10001000 to 10007228)
6400 size of raw data
400 file pointer to raw data (00000400 to 000067FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
60000020 flags
Code
Execute Read
SECTION HEADER #2
.rdata name
2B1C virtual size
8000 virtual address (10008000 to 1000AB1B)
2C00 size of raw data
6800 file pointer to raw data (00006800 to 000093FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only
Debug Directories
Time Type Size RVA Pointer
-------- ------- -------- -------- --------
5851907F cv 4B 0000969C 7E9C Format: RSDS, {8C39C0F9-EC2D-41B6-9C9F-C520DD627935}, 1, H:\src\the-name-of-the-dll\Release\the-name-of-the-dll.pdb
5851907F feat 14 000096E8 7EE8 Counts: Pre-VC++ 11.00=0, C/C++=46, /GS=46, /sdl=0, guardN=32
5851907F coffgrp 2C0 000096FC 7EFC 4C544347 (LTCG)
5851907F iltcg 0 00000000 0
SECTION HEADER #3
.data name
A64 virtual size
B000 virtual address (1000B000 to 1000BA63)
800 size of raw data
9400 file pointer to raw data (00009400 to 00009BFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
C0000040 flags
Initialized Data
Read Write
SECTION HEADER #4
.gfids name
48 virtual size
C000 virtual address (1000C000 to 1000C047)
200 size of raw data
9C00 file pointer to raw data (00009C00 to 00009DFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only
SECTION HEADER #5
.rsrc name
1E0 virtual size
D000 virtual address (1000D000 to 1000D1DF)
200 size of raw data
9E00 file pointer to raw data (00009E00 to 00009FFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only
SECTION HEADER #6
.reloc name
7D4 virtual size
E000 virtual address (1000E000 to 1000E7D3)
800 size of raw data
A000 file pointer to raw data (0000A000 to 0000A7FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
42000040 flags
Initialized Data
Discardable
Read Only
Summary
1000 .data
1000 .gfids
3000 .rdata
1000 .reloc
1000 .rsrc
7000 .text