Deploying Transactional Components

There are two methods of deploying transactional components: you can either deploy them using the Transaction Server Explorer or you can deploy them in a more automated fashion using Microsoft Visual InterDev 6.0. As we learned in Chapter 18, remote deployment for middle-tier COM server components is one of the exciting new features in Visual InterDev 6.0.

In this section, you'll learn how to perform both of these procedures. It's important to understand both techniques. Since Visual InterDev 6.0 allows you to remotely deploy these components from your workstation, you might want to modify some of the properties of your packages and components. These types of configuration operations can be performed only by using the Transaction Server Explorer.

Using the Transaction Server Explorer

Using the Transaction Server Explorer to deploy a transactional component requires that you first create a package and then install the component into that package. You'll also need to configure various properties of the package and its components.

First access the Transaction Server Explorer by choosing Start|Programs|Windows NT 4.0 Option Pack|Microsoft Transaction Server|Transaction Server Explorer or by choosing Start|Programs|Windows NT 4.0 Option Pack|Microsoft Internet Information Server|Internet Service Manager. Both of these options will launch the Microsoft Management Console. The following steps illustrate how to create a package:

  1. Open the folder named Computers.
  2. Open the icon named My Computer.
  3. Right-click the Packages Installed folder, and select New|Package from the context menu.
  4. In the Package Wizard, click the Create An Empty Package button. (See Figure 20-6.)
  5. Enter a name for the new package.
  6. Click Next.
  7. On the Set Package Identity step, select Interactive User.
  8. Click Finish.

You should now see an icon representing your new package under the Packages Installed folder.

click to view at full size.

Figure 20-6. The Package Wizard allows you either to create an empty package or to install prebuilt packages.

If you want to adjust any of the properties of your package, simply right-click the package and choose Properties to bring up the Properties dialog box. This dialog box has five tab folders for configuring the general, security, advanced, identity, and activation properties.

On the General tab, you can change the name of the package and add a description. On the Security tab, you can enable authorization checking and specify the authentication level for calls. The Advanced tab allows you to specify how the server process should be shut down. You can either keep the process running when idle or have the process shut down after a certain number of minutes of inactivity.

NOTE
When developing and testing your components, it's worth setting the value on the Advanced tab to 1 minute so that the process is shut down quickly after execution. This will enable you to compile other versions of the component and stage them within MTS without having to wait as long for the process to shut down.

The Identity tab is used to specify which account the process will run under. This can either be the currently logged on user or another Microsoft Windows NT user account that you specify. Finally, the Activation tab allows you to choose the activation type for your package. This can either be a library package or a server package. Server packages are recommended because they allow the component to be activated in a dedicated server process.

Now that you have created your package, you can install your component. The following steps illustrate how to achieve this:

  1. Start the Transaction Server Explorer.
  2. Open the icon representing your new package.
  3. Right-click the folder labeled Components in the left-hand pane, and select New Component from the context menu.
  4. In the Component Wizard, click the Install New Component button.
  5. In the Install Components dialog box, click Add Files.
  6. Use the Select Files To Install dialog box to navigate to the folder holding your ActiveX DLL. Select the DLL and click Open. You can continue adding components to the package if you wish.
  7. In the Install Components dialog box, click Finish. One or more icons, representing each of the various classes within your component, will appear beneath the folder labeled Components.

After installing the component, you'll need to configure the properties of the component. The following steps show how to achieve this:

  1. Right-click the icon representing your new component, and select Properties from the context menu to display the Properties dialog box, shown in Figure 20-7 below.
  2. Select the Transaction tab of the Properties dialog box, as shown in Figure 20-8.
  3. Select Requires A Transaction, and click OK.
  4. Right-click the folder labeled Roles underneath your package in the left-hand pane, and select New|Role from the context menu.
  5. In the New Role dialog box, type in the word Administrator.
  6. Open the Roles folder to display the icon representing your new role.
  7. Open the Administrator role icon to display the folder labeled Users.
  8. Right-click the Users folder, and select New|User from the context menu.
  9. Use the Add Users And Groups To Role dialog box to assign permissions. For testing purposes, you can simply select the group named Everyone from the list.
  10. Click Add, and then click OK. An icon representing the group will appear beneath the Users folder.

Figure 20-7. The General tab of the Properties dialog box for a component within the Transaction Server Explorer.

Your component is now ready for use! Figure 20-7 shows the General tab in the Properties dialog box. Here you'll notice the name of the DLL is listed as well as the CLSID and the package name. The CLSID is the component's class ID. This is the universally unique identifier (UUID) that identifies the component. The CLSID is stored in the Windows Registry. Figure 20-8 shows the Transaction tab of the Properties dialog box.

Figure 20-8. The Transaction tab of the Properties dialog box for a component within the Transaction Server Explorer.

Figure 20-9 shows the Transaction Server Explorer after we have created a package named MTS Example, installed components named mtsexample.ASP and mtsexample.transaction (both part of the mtsexample.dll ActiveX component that we created earlier), and added an Administrator role and associated users to the package.

click to view at full size.

Figure 20-9. The Transaction Server Explorer showing the components and roles that have been set up for the MTS Example package.

Using Visual InterDev 6.0

Now that we've seen how to deploy a component using the Transaction Server Explorer, let's take a look at the equivalent operation within Visual InterDev 6.0. The first step is to add your component to a Web project. The following steps show how to achieve this:

  1. Open up your Web project.
  2. Create a folder named Components under your Web project. (This step is not required but is good practice so that your middle-tier components are kept separate from your HTML and ASP code.)
  3. Prepare to add the component to the Components folder by right-clicking the folder and choosing Add|Add Item from the context menu.
  4. In the Add Item dialog box, choose the Existing tab.
  5. Locate your ActiveX DLL file, and choose Open.

Your component will now be added to your Web project.

Now that the component has been added to your Web project, you are ready to install it in Microsoft Transaction Server. You can do so by following these steps:

  1. Right-click the component, and choose Properties from the drop-down menu.
  2. Choose the Component Installation tab of the Properties dialog box.
  3. Check the Register On Server and Add To Microsoft Transaction Server Package check boxes, as shown in Figure 20-10.
  4. In the Package Name text box, enter the name of the package to add the component to.
  5. Select the transaction support option appropriate for your component, and choose OK.

Figure 20-10. The Component Installation tab of the component Properties dialog box within Visual InterDev 6.0.

When you enter a package name, you can either enter the name of an existing package within MTS or you can specify a new package and have Visual InterDev request MTS to create it for you. You'll remember from the discussion of transactional ASP in Chapter 19 that there are four available options for specifying transaction support. Table 20-1 summarizes these options.

Table 20-1. Transaction support options available on the Component Installation tab of the component Properties dialog box within Visual InterDev 6.0.

Option Action
Requires A Transaction Set the component's objects to execute within the scope of a transaction regardless of whether the client has a transaction.
Requires A New Transaction Create a new transaction for the component's objects to execute within regardless of whether the client has a transaction.
Supports Transactions Set the component's objects to execute within the scope of the client's transaction.
Does Not Support Transactions Set the component's objects to run without a transaction regardless of whether the client has a transaction.

After you select OK, the component will be registered on the server and will be added into MTS under the appropriate package with the appropriate transaction support option that you specified. You'll be able to see the sequence of events by watching the status bar in the lower left-hand corner of the screen.



Programming Microsoft Visual InterDev 6. 0
Programming Microsoft Visual InterDev 6.0
ISBN: 1572318147
EAN: 2147483647
Year: 2005
Pages: 143

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net