[ Pobierz całość w formacie PDF ]
.0 Option Pack Setup program.You can install MTS with or without IIS and the other Option Pack components.To install MTS1.Run the Option Pack Setup program.2.Choose Custom Install.3.Select (but do not uncheck) the check box for Transaction Server.4.Click Show Subcomponents.5.Check Transaction Server Core Components.This will also install the Microsoft ManagementConsole.Note that choosing the Development Option also installs the Data Accesscomponents.6.Click OK for the Setup program to do the install.The Windows NT 4.0 Option Pack and MTS also are available as part of the Visual Studio EnterpriseEdition Server Setup options.Select Server Setup; then select BackOffice Setup.Then you can selectNT Option Pack as an installation option (along with SQL server, and so on.)How MTS Works in Multitier ApplicationsTo use MTS in a multitier application, you build the business logic and functionality of yourapplication into a set of COM in-process servers.(An in-process COM server is a COM server thatresides in a DLL.) Each of these COM servers performs some function or well defined set of functionsin your application.The client programs in your application call these COM servers.The client programs do not performany communications with a database server directly.The COM servers constitute a middle tier that theclient programs call.This multitier architecture is illustrated in Figure 12.1.Figure 12.1 : Multitier architecture.In-process COM servers by themselves can't provide an adequate middle tier.MTS extends COM byproviding a wrapper for COM servers.You install these in-process COM servers in MTS, and MTSwraps them and gives them additional functionality.This additional functionality makes it possible forthese COM servers to be used effectively as a middle tier in a multitier application.Figure 12.2illustrates the role of MTS in multitier applications.Figure 12.2 : MTS in multitier applications.MTS wraps and extends the COM servers by intercepting the calls to them from client applications.MTS does this by causing the Registry entries for COM servers to point to the MTS runtimeenvironment, instead of to the COM server's DLL.You will recall from Day 9, "UnderstandingCOM," that the location of a COM server's binary (EXE or DLL) is stored in the Registry.Figure 12.3shows a sample Registry entry for an in-process COM.Figure 12.3 : The Registry entry for an in-process COM server.You can see in Figure 12.3 that the InprocServer32 key for this particular CLSID points toRDSATLMTS1.DLL (the filename derives from the fact that this example experiments with RDS,ATL, and MTS) in the WorkInProgress\RDSATLMTS1\Debug directory on the C drive.As you will recall from Day 9, when a client application requests a pointer to an interface to a COMserver (using the CLSID), the system locates the binary and loads it if necessary.The system then callsthe class factory in the binary to create an instance of the COM server (if an instance needs to becreated) and returns to the client a pointer to an interface to the COM server.(Refer to Figure 9.5 foran illustration of this process.)When you install an in-process COM server in MTS, the COM server becomes an MTS component.The Registry entry for that COM server is changed so that it no longer points to the DLL in which theCOM server resides.Instead, the Registry points to MTX.EXE, which is the MTS application binary.This is illustrated in Figure 12.4.Figure 12.4 : The Registry entry for an in-process COM server installed in MTS.You can see in Figure 12.4 that a LocalServer32 key that points to C:\WINNT\System32\mtx.exehas been added.Following the filename and pathname is a /p: command-line argument followed bya GUID.You can't see it in Figure 12.4, but the entry for the InprocServer32 key has beenemptied so that it no longer points to the COM server's DLL.This change in the Registry means that when a client application references this COM server's CLSIDto obtain an interface pointer to the COM server, the system does not look for and load the COMserver's DLL.Instead, MTX.EXE is located by the system (and loaded if necessary) and is passed the/p: command-line argument followed by the GUID shown in Figure 12.4.Remember that an MTS component is a COM server that has been installed in MTS.The GUID passedon the command line represents the particular MTS package that contains this MTS component.AnMTS package is a collection of MTS components that run in the same process.Managing MTS Components by Using PackagesMTS components are organized into MTS packages.Packages in MTS enable process isolation andsecurity to be established for sets of components.Process isolation ensures that a poorly writtencomponent, which could cause errors at runtime, cannot bring down other processes running on thatmachine.MTS package security ensures that only authorized users can access your application.To learn about MTS packages, and to begin today's development work, you will need to create yourown package in MTS.Run the Transaction Server Explorer, which (on NT) you can run by selectingthe Start, Programs, Windows NT 4.0 Option Pack, Microsoft Transaction Server, Transaction ServerExplorer menu.The Transaction Server Explorer runs inside the Microsoft Management Console andis shown in Figure 12.5.Figure 12.5 : The Transaction Server Explorer.The tree control in the left pane enables you to navigate among the various MTS objects
[ Pobierz całość w formacie PDF ]