Microsoft KB Archive/265672

= PRB: COM+ Configured Component Does Not Support Custom Marshaling =

Article ID: 265672

Article Last Modified on 12/5/2007

-

APPLIES TO


 * Microsoft COM+ 1.0
 * Microsoft COM+ 1.5

-



This article was previously published under Q265672



SYMPTOMS
A COM component that is configured in COM+ cannot be custom marshaled.

You can custom marshal a COM component:
 * When a COM component uses the Free Threaded Marshaler (FTM).
 * When a COM component is written to &quot;Marshal by Value.&quot;
 * When a COM component uses lightweight client-side handler.

A &quot;configured&quot; component is a component that is installed in a COM+ application, while an &quot;unconfigured&quot; component is a component that is not installed in a COM+ application.



CAUSE
The COM+ infrastructure does not use the QueryInterface method for the IMarshal interface from a configured component. This disables custom marshaling and enables standard marshaling instead to marshal the interface.

COM+ does not support custom marshaling because COM+ services are often implemented using policies that are triggered by the standard proxy and stub. Custom marshaled objects do not use the standard proxy and stub; therefore, they bypass services such as role checking, transaction support, and synchronization.



RESOLUTION
In most scenarios, you can use custom marshaling to keep data close to the client and avoid marshaling overhead to get different sub items of the data. You can achieve this by:
 * Passing data as arguments to functions.
 * Making the component that needs to be custom marshaled an unconfigured component.
 * Implementing an application-specific interface that takes the same data you would otherwise pass in the marshaled buffer in the &quot;Marshal by Value&quot; scenario. When the object is created, it is empty. The first thing a user needs to do is pass initialization/constructor data to the object by a method on the application-specific interface.

Keywords: kbserver kbprb KB265672

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.