Enforcing Activation in the Caller's Context
You can control whether an object gets activated in its own context. When you use the Component Services administrative tool to require component activation in the caller's context, the following occurs when COM+ activates an instance of the component in a context:
- The object is activated in the creator's context if possible.
- Object activation fails if it requires its own context; CO_E_ATTEMPT_TO_CREATE_OUTSIDE_CLIENT_CONTEXT is returned.
Whether or not the object requires its own context depends on its configuration relative to the current state of the caller's context properties. For more detail, see COM+ Contexts.
You would want to control activation at that fine a level if some aspect of your object would not function properly if it has its own context. For example, if the component does not support marshaling and it has its own context, any calls to it will fail because cross-context calls are intercepted and a lightweight marshal performed.
To enforce activation in the caller's context
In the details pane of the Component Services administrative tool, right-click the component (located within the Components folder of any selected COM+ application) for which you are setting activation properties and then click Properties.
In the component properties dialog box, click the Activation tab.
Select the Must be activated in the callers context check box.
Click OK.
Related topics