Microsoft KB Archive/243826

= INFO: Limitations of MFC COM Components Under ASP =

Article ID: 243826

Article Last Modified on 11/17/2003

-

APPLIES TO


 * Microsoft Internet Information Server 3.0
 * Microsoft Internet Information Server 4.0
 * Microsoft Active Server Pages 4.0

-



This article was previously published under Q243826



SUMMARY
When you call Microsoft Foundation Classes components from Active Server Pages (ASP) pages, you may encounter performance and concurrency problems under load. This article describes factors that you can consider to avoid such problems.



MORE INFORMATION
When you are deciding between MFC and Active Template Library (ATL) to build COM objects that will run under ASP, you must consider the following factors:
 * MFC is heavy code for the server, whereas ATL produces small, fast, strong components.
 * MFC can only produce single-threaded apartment (STA) components. While STA components can perform well under ASP at page-scope, they should not be stored in session or application scope. ATL supports all COM threading models and can create components marked Both and aggregate the free-threaded marshaler.
 * Internally, MFC uses thread local storage (TLS) data to synchronize access to MFC global data and resources. Under high-load, this can be a performance issue.
 * CString, CList, CArray and other MFC classes can add significant overhead to time-critical code. This is documented in MSDN under "Tips for Improving Time Critical Code."

