Forcing a .Net Windows service to run as 32-bit on a 64-bit machine

31,219

Solution 1

Maybe the .NET tool corflags will help:

corflags /32bit+ myservice.exe

Solution 2

corflags.exe comes with the Windows SDK, not .NET.

corflags.exe needs to run only once against the target service exe. Then the service will run in 32-bit mode thereafter.

Note the argument needed is /32bitreq+ or /32bitpref+ .

corflags.exe /32bitreq+ myservice.exe

Share:
31,219

Related videos on Youtube

Steve Cooper
Author by

Steve Cooper

Updated on February 16, 2020

Comments

  • Steve Cooper
    Steve Cooper about 4 years

    I've been given a windows service which references a COM component that only runs on 32-bit. My machine is x64, so the service tries to start, fails to create the COM component, and dies.

    I don't have the source, just the .exe file. Is there any way to force a service to start in 32-bit mode on a win64 machine?

  • BQ.
    BQ. almost 14 years
    +1 for the great answer, but the options come last: Usage: Corflags.exe Assembly [options]
  • David Knight
    David Knight about 12 years
    I had a problem where I got the message corflags : error CF001 : Could not open file for writing the solution was to add /force
  • quetzalcoatl
    quetzalcoatl almost 9 years
    Same problems are for services built as .dll and debugged in VS through WcfSvcHost. In this case, you can switch the flag on the WcfSvcHost itself. see article