pbies
pbies

Reputation: 724

64-bit solution ASP.NET with C# and one project 32-bit in C++

I'm trying to put on IIS (Windows Server 2012 x64) project, that have one ASP.NET web application x64 with one project in C++ that is both 32- and 64-bit. I've tried to replace the C++ project DLL's both 32- and 64-bit. Also I've tried many configurations: turn on and off "Prefer 32-bit" in Visual Studio, change AnyCPU (for all projects) to 64-bit, turn on and off "Enable 32-bit applications" in IIS. The problem is that IIS don't see the C++ project DLL (which should see, it's in the same folder) or can't load because of incorrect format. I would like to run the whole solution in 64-bit with eventually 32-bit C++ project, so changing everything to 32-bit would not be the right solution. Is there a way to put everything on IIS to run the application?

Upvotes: 2

Views: 702

Answers (1)

Alex Filipovici
Alex Filipovici

Reputation: 32561

You have to align the platforms to the same bitness. That is, you either:

  1. Compile both the web application and the C++ referenced project to 32-bit and set Enable 32-Bit Application to True for the IIS application pool.
  2. Compile both the web application and the C++ referenced project to 64-bit and set Enable 32-Bit Application to False for the IIS application pool.

If the C++ project has some other dependency on a 32-bit DLL which doesn't have a 64-bit version, that will be a problem. In this case, you have no option but to align everything to 32-bit.

Upvotes: 1

Related Questions