Click here to Skip to main content
13,901,208 members
Click here to Skip to main content
Add your own
alternative version


19 bookmarked
Posted 30 May 2001

Working with the COM+ admin objects under .NET/C#

, 30 May 2001
Rate this:
Please Sign up or sign in to vote.
An article that explores ,NET interoperability with COM components.
<!-- Download Links --> <!-- Main HTML starts here -->


This sample covers the following concepts:

  • Late binding to COM objects via Reflection
  • Using the XmlDocument, DocumentNavigator, etc within the System.Xml namespace to load XML files and fire XPath querries.
  • Using the COM+ admin objects to talk to the COM+ catalog and query the properties for each COM+ app installed as well as the components within them.


I wanted to explore the interoperability .NET provides with COM components. What would be a better way than to test it with existing components installed within the system. Since I already had worked with the COM+ admin objects sometime back and there not many samples are available on it, I thought that working with it in C# would be cool.

Source/Misc Files



Contains the client


Contains helper classes which are compiled as components


Builds the source files
ComPlusPropertyMap.xml Contains a complete list from MSDN about the various properties exposed by the Applications as well as the Components collection in XML format. *See diagram below.

Figure1 : ComPlusPropertyMap.xml


There are 2 approaches I could have taken to use these objects:

  • Use the tlbimp tool to generate equivalent .NET metadata to be used within C# or
  • Late binding via IDispatch using Reflection. I chose the latter purely to explore reflection. Using tlbimp would have been easier.

When a .NET client tries to use and instantiate a COM component, the .NET runtime exposes the object via something called a runtime callable wrapper (RCW) that acts as a proxy for the real unmanaged object. The .NET client is fooled in to thinking that it is talking to just another block of managed code. The primary function of the RCW is to marshal calls between the boundaries of the managed and unmanaged code. For more details/diagrams on the Runtime Callable Wrappers refer to the .NET Framework SDK documentation under .NET Framework Developer's Guide\Interoperating with Unmanaged Code\Advanced COM Interop\COM Interop Wrappers. Every body starts off/steals/borrows/enhances code from there.

In the example, I have create an instance of the COMAdminCatalog object along with these lines. Using this object I can get at the Application's collection exposed as a COMAdminCatalogCollection Object.

The sample comes with two helper classes dispCOMWrapper and COMPlusAdminHelper.The following lines uses these helper classes to print out the count of all the COM+ apps installed on your system.

dispCOMWrapper m_oCatalog;
dispCOMWrapper m_oDispColApps;
m_oCatalog = new dispCOMWrapper("COMAdmin.COMAdminCatalog");
m_oDispColApps = new dispCOMWrapper(m_oCatalog.callMethod("GetCollection",
                                                          new Object [] {"Applications"} ));
m_oDispColApps.callMethod("Populate",new object [] {});
Console.Write( "Total no of COM+ applications on your system :" + 

There is a method known as GenerateReport() within the COMPlusAdminHelper class that peeks in to the COM+ catalog and iterates each and every application and then through each and every Component within it, and while it does, it generates an XML based report in the same directory as the executable.
One can write equivalent XSL to display it in a more intuitive UI than the default vanilla XSL that IE provides.

The output file generated looks something like this:

Figure 2 :ComPlusReport.xml

Figure 3: The structure of the generated XML file.

To read/write/navigate xml files/nodes I have used the following classes provided the System.Xml namespace:

  • DocumentNavigator,
  • XmlNode,
  • XmlElement,
  • XmlNamedNodeMap,
  • XmlAttribute

One thing I have to admit. I found it difficult to initially move to a syntax different than the regular MSXML syntax for firing XPath querries, but then no choice, you gotta learn it.


Run build.bat, and then the sample.

References: (From the guru Aaron Skonnard himself)
(using COM+ admin objects from VC++)


I haven't done much bug testing though and not much exception handling :( Lemme know if any bugs.

And as usual as Paul Di Lascia says, If this works I am reponsible or I don't know who the hell did it !


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Ranjeet Chakraborty
Web Developer
United States United States
I am originally from Mumbai, India, Currently living in Los Angeles doing Software Development. If there is something I miss here in LA, its the crazy Mumbai monsoon and delicious "wadapavs".
Apart from spending time writing software, I spend most of my time with XBox riding the Warthog and killing covenants in Halo.

You may also be interested in...

Comments and Discussions

GeneralInteresting Pin
Johnny Magget1-Jun-01 6:50
memberJohnny Magget1-Jun-01 6:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web04 | 2.8.190306.1 | Last Updated 31 May 2001
Article Copyright 2001 by Ranjeet Chakraborty
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid