COM+ deployment with COMREPL

This week I was teaching another round of the course MOC2557 called Building COM+ applications using Microsoft .NET Enterprise Services. Another week to dive further into COM+ and look into things unexplored before. With this course I always seem to “loose” some students over the week. The last two times I started with 3 and ended with 1 student, due to sickness, vacation or because they reached a point where they could take no more and just didn’t show up on the last day. My two students of this week (should have been 4) were Octavie (who has a short article accompanied by an excellent .NET 1.1 darts score program up at CodeProject) and Wim. Both are excellent programmers and (more importantly) my first students ever to actually use COM+ on a daily basis.

Here are some pointers that they found very useful:

  • Use the [EventTrackingEnabled(true)] attribute on your classes to activate the statistics in the Status view of the Components folder.
  • In a library application no security checks are made for the process level. If you do not set the security level to Process and Component, not even checks on the components are made. If you use this combination, you have just effectively turned off security in the COM+ application.
  • The [SecureMethod] attribute forces you to use an interface reference to use the method on which it is declared (although you can set it at interface and component level as well). A new role called Marshaller is created, to which all users that need to use SecureMethod decorated method should be assigned.

We finished early and on the last day and had some time left to look at the deployment tool COMREPL. That works very cool. It will replicate your COM+ catalog to a specified set of target computers. COMREPL will only deploy the COM+ applications that are non-system and non-IIS (the ones that result from the High (Isolated) isolation level of the registered webapplication). It also deploys only the files that are needed by the COM+ application, such as assemblies and dependent files. You will need to do that manually.

The COMREPL tool can be found inside %windir%System32Com. You run this tool from a command line like so:

SET PATH=%path%;%windir%System32Com
COMREPL.exe sourcecomp targetcomp /v

The /v option is used to echo all output to the console.

If you use this tool from a Windows 2000 with SP3 or less machine which has the .NET Framework installed, you will run into problems. The deployment will halt when the target computer is installing the “.NET Utilities” COM+ application. If you experience this, read all about it in this knowledge base article 326095, and just install SP4. That will fix the problems. If you get this error message:

ERROR: Could not create the replication server object.  Error code was 800706ba.

you have specified a non-reachable or non-existent computer name. 

COMREPL goes through three distinct phases: Prepare, Copy and Installation. When the comrepl tool is run, it will first go into the Prepare phase and create a ReplicationReplicationSource under %windir%System32Com on a Windows 2000 machine. In this folder apl files are created for every COM+ application named comrepl.apl and are stored in subfolders named AppName + ApplicationID, e.g. MyCOMPlusApp{AD205066-73B0-4927-918A-C830B5FAD005}. In actuality, the .apl files are .msi files. Also, .cab files that contain an .inf file and these .apl files are also included.

During the Copy phase the folders are copied to the target computers into a folder under ReplicationReplicationNew. Once done, the Installation phase is entered and the folder is renamed to ReplicationCurrent. If this folder existed already, it is first renamed to ReplicationOld. All contents of an existing ReplicationOld folder are deleted.

What I found was undocumented is that this mechanism has changed for Windows XP, and presumably Windows Server 2003 (for which I haven’t tried using COMREPL). On a Windows XP box, the ReplicationSource folder of the Prepare phase is located under C:Program FilesCOM+ ApplicationsReplicationDef{Guid}. The Guid is the PartitionID of our machine. Windows XP only has one such Partition, Windows Server 2003 has one or more. The exported application files that are created are again .msi files with exactly that extension instead of .apl, but a set of two instead of one is generated. The newcomer is called comrepl10.msi, and will be installed on machines with COM+ 1.0, i.e. Windows 2000 machines. The entire directory tree is copied to the %windir%System32ComReplicationReplicationCurrent folder of the target machine.

So, if you have a web farm with COM+ applications on each of the servers, you should look into this COMREPL tool. Alternatively you can also take a look at Application Center 2000. This offers both Network Load Balancing (no Windows 2000 Advanced Server required: it will install the NLB components on a normal W2K server) and Component Load Balancing (CLB) for COM+ application clusters. AC2000 is far cooler that COMREPL, but you would have to pay some coins to get the product.

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s