Problem solve Get help with specific problems with your technologies, process and projects.

COM+ component services

This article discusses COM+ services for in-process components such as JIT, synchronization, transactions, object pooling, constructor strings and shared property group manager.

Please let other users know how useful this tip is by rating it below. Do you have a tip or code of your own you'd like to share? Submit it here.

Classes written using the Microsoft .NET Framework can make use of COM+ services in an integrated and logical manner. This article discusses COM+ services for in-process components such as JIT, synchronization, transactions, object pooling, constructor strings and the shared property group manager.

Today, developers use such tools as Microsoft Visual Studio 6.0 to build COM+ components and install the components in COM+ applications to use COM+ services. With Visual Studio.NET, managed classes are built and then installed in COM+ applications, in order to get such COM+ services as transactions, object pooling and activity semantics. Using Visual Studio.NET and the .NET Framework provides a number of advantages over Visual Studio 6.0 -- namely, better tools, the common language runtime and a much easier coding syntax. Each managed class can be hosted in a coexisting COM+ context; thus, managed classes can take full advantage of all the COM+ services. In the .NET Framework, these classes are known as serviced components. Any managed class can be modified to use COM+ services. The Microsoft.ComServices namespace provides various custom attributes and classes to assist the developer in accessing these services from managed code.

Creating BankComponent.cs

using System;
using System.EnterprizeServices;
using System.Runtime.CompilerServices;
[assembly: ApplicationName("BankComponent")]
[assembly: AssemblyKeyFileAttribute("TestApp.snk")]
public class Account : ServicedComponent
// SetComplete automatically called if no exception
public bool Post(int accountNum, double amount)
// .. update the database, no need to call SetComplete
return true;
// - Registration details -
// COM+ Application Name to add the Component

// Strong Name for Assembly


Creating BankConsoleClient.cs

using System;
using BankComponent;
namespace BankComponentConsoleClient
class Client
public static int Main()
Account act = new Account();
act.Post(5, 100);
return 0;

Compile the files with the following procedure

SN –k TestApp.snk
csc /target:library /r:Microsoft.ComServices.Dll BankComponent.cs
csc /target:exe /r:BankComponent.Dll BankConsoleClient.cs

When you invoke the BankConsoleClient.exe, the COM+ application gets generated. Now the component is ready to use the services of COM+ runtime and can be accessed using VB6.

Figure 1

This was last published in June 2003

Dig Deeper on .NET development community

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.