COM+ supports components that are compiled for both 32-bit and 64-bit architectures. When you install a component into COM+, COM+ examines the dynamic link library (DLL) of the component to determine whether it is compiled for the 32-bit architecture or the 64-bit architecture. If COM+ cannot examine the DLL (that is, you are using type library-based registration), COM+ will examine the InprocServer32 registry key for the component CLSID to determine the correct architecture. (A 32-bit component will be registered in the 32-bit registry hive, and a 64-bit component will be registered in the 64-bit registry hive.)
32-bit, 64-bit, and Neutral Managed Assemblies
Using Visual Studio 2005, you can create managed assemblies that support either 32-bit or 64-bit architectures, or you can create neutral managed assemblies that support both 32-bit and 64-bit architectures.
32-bit and 64-bit COM+ Applications
When you create a COM+ application implicitly (that is, you use Regsvcs.exe to register an existing component, but you have not yet created the COM+ application), COM+ will create an application whose architecture matches that of the component. However, if you install a component into an existing COM+ application, the architecture supported by the component must match that of the COM+ application.
When you use the Component Services Explorer to install a managed assembly into a COM+ application, COM+ will examine the assembly to determine what architecture it supports. A neutral assembly will be regarded as supporting the 32-bit architecture.
Visual Studio 2005 ships with 32-bit and 64-bit versions of Regsvcs.exe. The 32-bit version of Regsvcs.exe will register a component in the 32-bit registry hive, and the 64-bit version will register a component in the 64-bit registry hive.
The following table describes the results for installing the different types of components into the different types of COM+ applications. For example, if you use Visual Studio 2005 to compile a neutral managed assembly, then install it into an empty COM+ application using the 64-bit version of Component Services Explorer, COM+ will treat your neutral managed assembly as a 64-bit component.
| Type of COM+ application: | Managed component compiled in Visual Studio 2005 as: | Install component using 64-bit Component Services Explorer | Install component using 32-bit Component Services Explorer | Install component using 64-bit version of Regsvcs.exe | Install component using 32-bit version of Regsvcs.exe |
| Empty COM+ application | Neutral | 64-bit | 64-bit | 64-bit | 32-bit |
| | 32-bit | 32-bit | 32-bit | Error | 32-bit |
| | 64-bit | 64-bit | 64-bit | 64-bit | Error |
| COM+ application with 32-bit version of component already installed | Neutral | 32-bit | 32-bit | Error | 32-bit |
| | 32-bit | 32-bit | 32-bit | Error | 32-bit |
| | 64-bit | Error | Error | Error | Error |
| COM+ application with 64-bit version of component already installed | Neutral | 64-bit | 64-bit | 64-bit | 32-bit |
| | 32-bit | Error | Error | Error | Error |
| | 64-bit | 64-bit | 64-bit | 64-bit | Error |
Deploying 32-bit and 64-bit Assemblies
When you deploy a COM+ application proxy to another computer, the proxy package installs the assemblies contained in that application to the client computer. If the assemblies in the COM+ application are neutral, they can be loaded by either a 32-bit or 64-bit client. However, if an assembly supports only the 32-bit architecture, it can only be loaded by a 32-bit client, and if it supports only the 64-bit architecture, it can only be loaded by a 64-bit client.
The following table describes the results for 32-bit and 64-bit clients calling COM+ 32-bit and 64-bit applications.
| | COM+ 32-bit library application | COM+ 32-bit server application | COM+ 32-bit server application | COM+ 64-bit library application | COM+ 64-bit server application | COM+ 64-bit server application |
| | 32-bit assembly | 32-bit assembly | Neutral assembly | 64-bit assembly | 64-bit assembly | Neutral assembly |
| Managed 32-bit client | Succeeds | Succeeds | Succeeds | Fails | Fails | Succeeds |
| Managed 64-bit client | Fails | Fails | Succeeds | Succeeds | Succeeds | Succeeds |
See Also