I've been fooling around with .NET, Remoting and the BYOT service offered by COM+. The result is this simple application.

To build the files, just fire up cmd.exe, switch to the directory you unzipped the file to, and do nmake all. This will compile all files and install two COM+ applications on your machine: TxRoot and TxInterior.

The application is actually pretty simple: It has two executables. The first one, TxRootCaller, creates a COM+ object (TxRoot) in a library application inside a declarative transaction (it is marked Transaction Required). TxRoot underneaths gets the TIP transaction URL, and calls via .NET Remoting using SOAP into the other application, passing it the transaction URL. On the other hand, we have TxInteriorHost.exe, which simply exposes a simple shim object using .NET remoting. When that object is called, it uses BYOT to instantiate a second COM+ object (TxInterior) marked as Transaction Supported inside the distributed transaction.

The result of running both client and server looks like this:

E:\Projects\Com+\TxExp>bin\TxRootCaller.exe
Starting...
++ TxRootObject::DoYourWork()
ContextID: 623f99b5-2bb7-426b-8967-5c4c55c62ecf
TransactionID: cccdde96-e2f1-4f5c-b7a0-e738542247c3
Transaction URL: tip://radiant.EPM.NET.CO/?OleTx-cccdde96-e2f1-4f5c-b7a0-e738542247c3
-- TxRootObject::DoYourWork()
E:\Projects\Com+\TxExp>bin\txInteriorHost.exe
Starting...
++ RemoteFacade::DoYourWorkWithTx()
++ TxInteriorObject::DoYourWork()
ContextID: 7201e837-96dd-4794-9aa9-12f41af4257b
TransactionID: cccdde96-e2f1-4f5c-b7a0-e738542247c3
-- TxInteriorObject::DoYourWork()
-- RemoteFacade::DoYourWorkWithTx()

Obviously, this is a very contrived example, but I thought it was pretty cool :)

Unfortunately, the sample as it is doesn't actually run on Win2k, not even with SP3; instead, TxInteriorHost just magically disappears, leaving a message like this one on the Application Event Log:

Event Type:	Error
Event Source: COM+
Event Category: Executive
Event ID: 4230
Date: 8/18/2002
Time: 12:20:48 PM
User: N/A
Computer: CMEDINA
Description:
COM+ Internal Error. Please contact Microsoft Product Support Services
to report this error. Assertion Failure:
g_pDispManDriver != NULL
Process Name: TxInteriorHost.exe
The serious nature of this error has caused the process to terminate.
COM+ Services Internals Information:
File: .\txstream.cpp, Line: 899

The sample runs just fine on XP, though. I have a guess as to what the problem is, but it is a very uneducated guess, as this is the first time I fiddle around with BYOT. I'd love it if someone could point out any other information on it!


Tomas Restrepo

Software developer located in Colombia. Sr. PFE at Microsoft.