This article covers some 64 bit aspects regarding managed code and COM+ applications. The 64 bit info regarding managed code was taken from Josh Williams' blog and I want to thank him for putting all this useful information online. Personally, I found his postings very usefull. The COM+ application info I was able to find it in the documentation for CoCreateInstanceEx and CLSCTX enumeration.
Josh's articles cover mostly the subject of porting managed code EXE apps to 64 bit. Here are some links that you will find very useful:
If you don't have the patience to read these articles, here's my scaled down summary with explanations removed:
The articles above, however do not cover the COM+ application case. Let's say I have an out-of-proc managed COM+ component. This component is implemented as a C# class derived from ServicedComponent with attribute ApplicationActivation set to ActivationOption.Server. The assembly containing this component was compiled using .Net 2.0 and it's marked as anycpu/MSIL. This means that the assembly and component are processor neutral and it can run as both 32 and 64 bit on a 64 bit machine. Because the server is out-of-proc, the client and server do not need to share the same bitness. The client can be 32 bit and the server 64 bit, or viceversa. This can be used successfully to integrate legacy 32 bit components into 64 bit applications. Here's an article named 64-bit Insider that covers this aspect.
When a client app instantiates this component, the COM+ component will be created in its own process. Will that process have the same bitness as the client, will it have the bitness determined by the COM+ application settings or by the managed code setting? This article http://windowssdk.msdn.microsoft.com/en-us/library/ms693716.aspx about CLSCTX (paramater to CoCreateInstance) shades some light on some of these aspects, so I included some of the information here. Here's my summary:
The table below taken from MSDN documentation shows the results of the various combinations of client architectures and client settings and server architectures and server settings.
I hope you found this information useful.
32-bit client, no flag
64-bit client, no flag
32-bit client, 32-bit flag1
32-bit client, 64-bit flag2
64-bit client, 32-bit flag1
64-bit client, 64-bit flag2
32-bit server, match client registry value3
32-bit server, 32-bit registry value4
32-bit server, 64-bit registry value5
32-bit server, no registry value6
32-bit server, no registry value,
Windows Server 2003 SP17
64-bit server, match client registry value3
64-bit server, 32-bit registry value4
64-bit server, 64-bit registry value5
64-bit server, no registry value6
64-bit server, no registry value, Windows Server 2003 SP17
3 PreferredServerBitness registry value = 1. See PreferredServerBitness.
4 PreferredServerBitness registry value = 2.
5 PreferredServerBitness registry value = 3.
6 PreferredServerBitness registry value is missing and Windows Server XP or Windows Server 2003 without SP 1 or later is installed.
7 PreferredServerBitness registry value is missing and Windows Server 2003 SP 1 or later is installed.
8 Fails with CO_CLASSNOTREG error.
9 A 64-bit server is activated if it exists; otherwise a 32-bit server is activated.
10 A 32-bit server is activated if it exists; otherwise a 64-bit server is activated.