Deploying COM+ Applications

Once you have tested your COM+ application and configured all the COM+ services to your liking, you need to install your application on a customer/client machine. The Component Services Explorer can generate a special file that captures all your application components and settings. This file is a Windows Installer (MSI) file, identified by the .msi file extension. Clicking on an MSI file launches the Windows Installer and installs the application with all its COM+ configuration parameters. There is a one-to-one relationship between an application and an MSI file. Thus, if you have multiple applications in your product, you must generate one MSI file for each application.

To generate the MSI file, right-click on your application icon in the Component Services Explorer and select Export from the pop-up context menu. This action should bring up the Application Export Wizard. Click Next to go to the second wizard screen, where you are requested to enter the name and location for the application export file to be created (see Figure 1-13). Next, you should decide how to export the application: as a Server application or as an Application proxy (see Figure 1-13). Click Next and then click Finish on the next Wizard screen.

Exporting a COM+ application

Figure 1-13. Exporting a COM+ application

Proxy COM+ Applications

The names Server application and Application proxy are confusing. A “Server application” export is relevant for both library and server applications. It means that the application will include in the MSI file the COM objects themselves, their settings, and their proxy/stub DLLs (if required), and will install all on the server machine.

An “Application proxy” export installs on the client machine only the type information in the MSI it creates (as well as the proxy/stub DLLs, if required). The generated file does not have to include the components themselves (unless the type information is embedded in the components, in which case the components are only used as containers and are not registered). You can use a proxy installation when you want to enable remote access from a client machine to the machine where the application actually resides. A proxy export is available only for a COM+ server application, not for a library application.

When you install a server export on another machine, it will install the components for local activation. CoCreateInstance( ) requests create the objects locally—in the client process, if it is a library application, or in a dllhost process, if it is a server application.

When you install a proxy export, activation requests on that machine will be redirected to another remote machine. In a way, a proxy export installed on a client machine is a third kind of COM+ application. This kind is usually called a proxy application. You can configure the proxy application to access any remote machine on the network where the server application is installed, not just the machine that generated the proxy export. You specify the “real” application location on the proxy application properties page under the Activation tab.

A proxy application can even be installed on machines running Windows NT or Windows 9x with DCOM, provided those machines have Windows Installer installed on them. Because the Windows Installer cannot use the COM+ catalog to store the proxy application information on a non-Windows 2000 machine, it will use the registry and will store only the subset of information required for DCOM there. Windows Installer is not commonly found on non-Windows 2000 machines. To make sure clients on those machines are able to access your COM+ applications, you should incorporate the Windows Installer installation in your product installation. The Windows Installer installation file is called instmsi.exe and is available as part of the Developers Platform SDK.

A proxy application cannot export another MSI file. In fact, all the application-component, interface, and method-level settings on a proxy application are disabled, except the Remote server name under the Activation tab. The Remote server name edit box is disabled in library and server applications.

Installing and Uninstalling an Exported Application

The most common way to install an MSI file on another machine is simply to click on it, which will launch the Windows Installer. The application files (DLLs and proxy/stubs) will be placed in a default location:

\Program Files\COMPlus Applications\{<the application's guid>}

If you wish to have the application installed in a different location, you must use the Component Services Explorer Application Install Wizard. Bring up the wizard and select Install pre-built application(s). Browse to where the MSI file is stored, and select it. The wizard will let you choose whether you want to use the default location for installation or specify a different one.

If you want to automate uninstalling COM+ applications, you can use a command line instruction to invoke the Windows Installer to uninstall a COM+ application:

msiexec -x <application name>.msi

You can also use the Windows Control Panel’s Add/Remove Programs applet to add or remove COM+ applications.

Get COM & .NET Component Services now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.