1

I am working on a .NET ASP.NET Core app. This app uses some db which require a 32 bit driver (at least for now).

According to the documentation, using the Prefer 32-Bit flag should generate an Any-CPU program that will work in 32-bits both in windows 32 and in windows 64.

However in ASP.NET .NET Core that setting does not seem to work.

I workaround is to set my project as x86 but I would like to know if this is a know issue or if I am doing something wrong.

orellabac
  • 2,077
  • 2
  • 26
  • 34
  • maybe iis is 64Bit? https://stackoverflow.com/questions/16226582/how-can-i-force-iis-express-to-run-in-32-bit-mode – Stanislav Nov 26 '20 at 23:12
  • "Prefer 32bit" means exactly that: if there is a choice, run me as 32bit, but I'm happy with 64bit, too. "x86" forces 32bit. – Klaus Gütter Nov 27 '20 at 06:08
  • @KlausGütter I think what you say is not true. For example according to this (link)[https://dzone.com/articles/what-anycpu-really-means-net] * if the process runs on a 32-bit windows system, it runs as a 32-bit process. il is compiled to x86 machine code. * if the process runs on a 64-bit windows system, it runs as a 32-bit process. il is compiled to x86 machine code. * if the process runs on an arm windows system, it runs as a 32-bit process. il is compiled to arm machine code. So Prefer 32bits forces 32 bits. Well ... it used to at least for .NET Framework – orellabac Nov 27 '20 at 17:54
  • 1
    It forces 32 bits, unless the hosting process is 64 bits. If a 64 bit application loads your assembly, the IL will be complied to 64 bit. Most of these tables reference what to happens when *your application* loads. Not when are other application loads your assembly. IIS has its own setting to set an application pool to 32 bit. The default is 64 bit for IIS. – jessehouwing Mar 06 '22 at 21:39

0 Answers0