This threading model is not recommended for components that will be called by Active Server Pages.

Free-threaded objects place no restrictions on which threads or how many threads can enter the object. The object cannot contain thread-specific data and must protect its data from simultaneous access by multiple threads.

The Web server creates free-threaded objects in a different thread than the one that called CoCreateInstance. All calls to the object are marshaled to a free-threading thread.

One disadvantage of free-threaded objects is that they cannot be stored in the Application object. The only way to create a free-threaded object with application scope is to declare it with an <OBJECT> tag. However, when this object is used, the Web server will lock the application down to a single thread, the one that created the object. This will reduce server performance significantly, and should only be considered for intranet applications.

In addition, if a free-threaded object is created with session scope or is stored in the Session object, the Web server will lock the session down to the single thread that created the object.

© Microsoft Corporation. All rights reserved.