Is it possible to write an IIS Module in C++ that is compiled 32bit?

Smith, Roland 40 Reputation points

I've created a Module in C++ which works well so far. The problem I have is that I'd like to have it be 32bit. I compile the DLL as 64-bit and it works fine. I compile as 32-bit and edit applicationHost.config and change preConditions to bitness32 or remove preConditions and it fails. Is it possible or am I missing something? Current entries in applicationHost.config (working 64-bit) that were added by IIS Manager:

    <add name="TopwizWebModule" image="C:\source\repos\TopwizWebModule\x64\Release\TopwizWebModule.dll" preCondition="bitness64" />

<handlers accessPolicy="Read, Execute, Script">
    <add name="TopwizWebModule" path="*.topwiz" verb="*" modules="TopwizWebModule" resourceType="File" preCondition="bitness64,winx86_64" />

    <add name="TopwizWebModule" preCondition="bitness64" />
Internet Information Services
0 comments No comments
{count} votes

Accepted answer
  1. XuDong Peng-MSFT 8,096 Reputation points Microsoft Vendor

    Hi @Smith, Roland

    Is it possible or am I missing something?

    I think you may have forgotten to set Enable 32-Bit Application to True for the IIS application pool, so that the web application and the dll run at the same bitness.

    User's image

    Best regards,

    Xudong Peng

    If the answer is the right solution, please click "Accept Answer" and kindly upvote. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Lex Li (Microsoft) 4,242 Reputation points Microsoft Employee

    First, you will have to prove that you did compile the code to a 32 bit library. Use a tool from Visual Studio command prompt like dumpbin to verify

    Second, I suggest you put 32-bit and 64-bit library files to IIS installation folders (32 bit in %windir%\sysWOW64\inetsrv and 64 bit in %windir%\system32\inetsrv and then registered in <globalModules> as <add name="TopwizWebModule" image="%windir%\System32\inetsrv\TopwizWebModule.dll" />.

    Finally, you can enable the module in your site/application by adding it to <modules> like <add name="TopwizWebModule" />.