John Lam 1997 — 2026

Enterprise Services?

I have been watching from the sidelines the recent discussion on Enterprise Services in .NET. Clemens Vasters started it, with Ingo Rammer and Tomas Restrepo chipping in with additional comments. I’ve been quite busy lately, so I haven’t had a chance to respond yet. My response centers around this question:

If I’m writing a managed application that has a web-based front end[1], and I don’t need distributed transactions, why do I need to care about Enterprise Services?

The way I see it, almost all of what was in COM+ (and please, let’s just call it COM+ for simplicity) is now duplicated in the frameworks.

Let’s first begin with load balancing. I tend to look at load balancing as a technology that improves the robustness of your application with load balancing as a nice side-effect. If you are using HTTP as your transport, there are lots of nice hardware load balancing solutions available, and they scale extraordinarily well.

By using HTTP as your transport, you are most likely going to be using IIS as the gateway to your application. This leads to the next feature that was provided by COM+: thread pooling. If you can assume HTTP as your transport, then your thread pool is effectively IIS.

Now, in a traditional ASP application there was always the question of “where do my application layer components go?” In almost all cases, the answer is that your application layer components physically run on the same computer as IIS. If you decide to run your application layer components on another computer, you run into the (hard) problems involved in load-balancing COM+ components. Besides, I always question why one would want to load-balance a load-balancer unless you can show me data that shows that this is a more effective solution for your application.

In a managed application, your application layer components should reside on the same computer as IIS. This is what you get by default if you use ASP.NET as the gateway into your managed code. ASP.NET has some nice plumbing that (nearly) abstracts away the fact that IIS (and Windows for that matter) is the baseline technology. This way you automatically get the benefits of HTTP load balancing and thread pooling. Not bad for doing absolutely no work whatsoever!

Next up is role-based security. In the pre-MTS/COM+ world, folks that built server applications also had to build a separate administration tool that would be used to manage the security requirements of those components. MTS/COM+ eliminated that requirement by providing a standard MMC (Microsoft-Management Console) snap-in that let developers define roles and that let administrators populate those roles with actual user accounts and groups.

The downside of the MTS/COM+ technologies are that they were tightly coupled to the Windows security model. In the managed world, there is also a notion of roles. However, these roles are now decoupled from the underlying OS security model. You now have the flexibility to define roles based on Windows users and groups, or you can map roles to a custom authentication scheme that you can provide. This is significantly more important in building large-scale applications today, since you can no longer assume that clients will run within the same Windows domain or on a domain with appropriate pre-established trust relationships.

Next up is the (controversial) object pooling feature of COM+. In most cases, the object pool was used to overcome a deficiency in the OLE DB database connection pool - you couldn’t tune the min and max pool size parameters on a per-application basis. What you could do, however, was define a class of objects where each object which holds onto a single OLE DB connection. You then place that class under the control of the COM+-managed object pool. This way you could use the min and max object pool size parameters in COM+ to tune the database connection pool size.

In the managed world, however, you now have the Min Pool Size and Max Pool Size connection string parameters if you are using the SQL Managed Provider. This eliminates the need for object pooling in the vast majority of the applications that used this feature in the COM+ world. Building your own managed object pool requires you to do some work if you absolutely need to use this feature. There are some nice examples of object pools in the frameworks for you to examine (see System.Web.HttpApplication and friends in system.web.dll) if you are inclined to build your own.

IMHO the features that I outlined here: thread pooling, database connection pooling, load balancing, role-based security, and object pooling are the typical features used in most COM+ applications. And they all have managed equivalents. But, you ask, what about transactions?

Don’t forget that you don’t need COM+ to do transactional programming against a single resource manager. You can always use that resource manager’s native transactional API to obtain the ACID transaction benefits. However, where COM+ really helps out is in the realm of distributed transactions that involve more than one RM; this is where COM+ really shines. That said, however, there are very few applications out there that actually use distributed transactions.

So, this begs the question: if I’m writing a managed application that has a web-based front end[1], and I don’t need distributed transactions, why do I need to care about Enterprise Services?

[1] That will migrate to a Web Services front end once we evolve out of our current (irrational) infatuation with browser-hosted applications.

5 archived reader comments

Richard Caetano (2002-12-03)

great book indeed! At my last job I was involved with a system built on Transactional COM+. The problem was nobody new how to use it…they just relied on kamakazi sytle coding. Transactional COM+ (the book) helped me greatly … the transaction stream information was very helpful! http://www.stronglytyped.com/weblog/TransactionalCOM+Building.html

Chris Sells (2002-12-04)

What changed your mind, John? I agree that COM+ seems unnecessary unless you need distributed transactions (which most never do).

John Lam (2002-12-06)

I like declarative transactions. This way, I can build components that can vote on the outcome of a transaction without resorting to a design pattern that requires passing SqlConnection objects as parameters. Now if they would only hurry up and fix the issue with single RM transactions using 2PC, we’d be set!

P.Gielens (2002-12-08)

Thnx for the pointers John

Vagif Abilov (2002-12-11)

At last you agreed guys! And we working in far snow deserts can now work efficiently without choosing sides. Until this point of agreement was reached I felt like I had to rewrite my code every second day