Installing a COM component into Microsoft Transaction Server(MTS) for the first time.

MTS should be named COM server. It is a server designed to serve out instances of COM components. MTS offers some added performance to any application that acts as an MTS client because it also pools COM instances for reuse. Instances are created when client demand requires.

MTS is also quite easy to use once a few details are known and observed. Existing DLLs that were compiled using VB without the Uses Transactions section selected may also be loaded into MTS. This example will demonstrate that effort.

Open the MTS console.

Default location for MTS console

MTS is part of the NT 4 Option Pack. The NT4 Option pack is freely available from the MS web site and it can be loaded on W9x and W NT4.

After MTS has been opened.

MTS console opened

Expand the Packages Installed folder. Right click the New -> Package menu. Components reside in packages. Components within the same package must have the same threading model. Security is associated with any given package so the rights for a given package affect all of the COM objects loaded into the package.

Add a new Package.

Adding a new Package

Choose Create an empty package.

Creating an empty package.

Create an empty package

Choose a name for the new package. This will be used to display in the MTS console. The COM component will still be called and instanciated by the component's actual name in your code.

Choose a name for the new package.

Choose a name for the new package

Select a user to run the component. If you choose the current logged in user then, the component will not run when you log off the computer. For web applications you want to choose a user can get access at any time.

Select a user to run the component.

Choose a name for the new package

Since we are installing this for the first time, we will create a user under which MTS will run the COM object we are loading. The user must be created so we will start User Manager for Domains.

Start User Manager for Domains.

User Manager for Domains

Create new user named OCCONTENT_MTS_USER. Grant the new user rights to run COM objects by adding them to group named MTS Impersonators Note: the new user is running under the domain of the server, not another domain.

Create new user.

New MTS User

Set the new package to run using the identity of the new user created (OCCONTENT_MTS_USER).

Set Package ID

OCCONTENT_MTS_USER

A new package should be created. Open the package properties page by right clicking on the name of the package in the left panel of the MMC and clicking on "Properties".

Package Properties page

Package Properties page

Select the Activation tab. The default setting is Server Package. This setting is more robust but not very efficient when there are many concurrent users as we have in a web type environment. Change the setting to Library Package. If we had fewer connections then Server package would be prefered.

Set Component Activation

Change the activation from Server to Library

Now we will begin to add our component to the new package we created. Navigate to the Components folder of the newly created package. Right click New -> Component menu.

New Component

add our component to the new package

Choose Install new component(s) if the DLL is not registered on the machine already. The DLL that we are loading is not registered because it was compiled on a different machine. If the component(s) are already registered, then choose the Import ... button. I noticed that the interface is added into MTS if the components are added as new instead of already registered. I would recommend unregistering your DLL(s) if they are registered and load them as new component(s). Note: Compiling on a computer in VB will result in the generated DLL registered.

Install new component(s)

Install new component(s)

Click the Add files... button to get the file request dialog box and open the appropriate DLL you want to load. We are loading the OCContentStock.dll component in this example.

Open the appropriate DLL you want to load

Choose the DLL file

The file should be loaded and the components should be recognized. More files may be added if you desire to add more components to the package.

File loaded

COM is in

Congratulations! The COM object is now in MTS. The spherical icons in the MTS console will spin each time the object is instanciated and used. The statistics folder will not reflect anything unless the MTS object reference is compiled into the DLL file and the interface is implemented in the object.

COM object is now in MTS

All Done

Copyright 2000 Scott Hofmann. All Rights Reserved. Distribution of this document unedited in it's entirety is encouraged.