Free-Threaded Components

Building Free-threaded components is not recommended; if possible, you should use the Both model instead. One disadvantage of Free-threaded components is that you must register them with the Component Services Manager in order to access the ObjectContext object, whereas all Both- or Apartment-threaded components can access ObjectContext. This means that Free-threaded components that you have not registered with Component Services Manager can only access the ASP built-in objects through the ScriptingContext object. This method of accessing the built-in objects is considered less suitable for ASP components than using ObjectContext.

The final problem with Free-threaded components is that, like Single-threaded components, they run in the SYSTEM context, rather than the context of the logged-on user. As a result, the Free-threaded model is not acceptable for scenarios that will rely on Windows® security to control access to objects.

The Microsoft Active Template Library (ATL) provides a very easy way to declare that your component supports both Apartment and Free threading models (the Both threading model). You can use the ATL Object Wizard in Visual C++ 5.0 to set the threading model support through the Attributes tab of the properties page. For more information on ATL see the Visual Studio documentation and the Additional Resources section.