INFO: Limitations of MFC COM Components Under ASP (243826)



The information in this article applies to:

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

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."

REFERENCES

Developing Active Server Components with ATL

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

231592 BUG: ATL ClassWizard Uses AfxGetStaticModuleState() in MFC EXE


Modification Type:MajorLast Reviewed:11/17/2003
Keywords:kbinfo kbThread KB243826