FIX: Performance Degrades When You Call Methods of a ServicedComponent

Article translations Article translations
Article ID: 327782 - View products that this article applies to.
This article was previously published under Q327782
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

On This Page


When you make a call from a remote .NET AppDomain to a Microsoft .NET component that is configured in COM+, you may experience performance slowdown in the AppDomain that initiated the call. This problem occurs only when you invoke methods on a ServicedComponent that is hosted by a COM+ server application.


When a managed application dispatches method calls to a ServicedComponent that is hosted in a COM+ server application, the .NET Framework must marshal method parameters. To improve performance, the internal marshaling layer uses a cached MemoryStream object to marshal and unmarshal the parameters. However, the marshaler always uses the full MemoryStream buffer for every call, instead of passing only the minimum required data.

Because the marshaled stream can become larger than necessary, applications that use large parameters at one time may experience performance degradation for calls that use small parameters later.


A supported fix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Apply it only to computers that are experiencing this specific problem. This fix may receive additional testing. Therefore, if you are not severely affected by this problem, Microsoft recommends that you wait for the next .NET Framework service pack that contains this fix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the fix. For a complete list of Microsoft Product Support Services phone numbers and information about support costs, visit the following Microsoft Web site:
NOTE: In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The typical support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English version of this fix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
   Date          Time    Version        Size      File name
   10-Aug-2002   09:51   1.0.3705.302   208,896   System.EnterpriseServices.dll
   09-Aug-2002   23:23   1.0.3705.302    47,104   System.EnterpriseServices.Thunk.dll

This fix is designed specifically to be installed on a system that already has the Microsoft .NET Framework Service Pack 1 installed. If you must have this fix on a system that has Microsoft .NET Framework Service Pack 2 installed, click the article number below to view the article in the Microsoft Knowledge Base:
328545 INFO: Post-Service Pack 2 .NET Framework Hotfix Rollup Package 2


Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.


Steps to Reproduce the Behavior

The following is minimal information relevant to demonstrating the problem that is discussed in this article. For additional information about how to create ServicedComponents, click the article number below to view the article in the Microsoft Knowledge Base:
306296 HOW TO: Create a Serviced .NET Component in Visual C# .NET
To reproduce the problem, follow these steps:
  1. Use the following code to create a COM+ component:
    using System;
    using System.Reflection;
    using System.Runtime.CompilerServices;
    using System.EnterpriseServices;
    [assembly: AssemblyVersion("")]
    [assembly: AssemblyKeyFile("ComPlusTest.snk")]
    [assembly: ApplicationName("ComPlusTest")]
    [assembly: ApplicationActivation(ActivationOption.Server)]
    public class CServer : ServicedComponent
       public String Exec(byte [] param)
    	return "done";
  2. Use the following code to create a client application:
    using System;
    public class CClient
       public static void Main()
          CServer pObj = new CServer();
          byte [] pLarge = new byte [2000];
          byte [] pSmall = new byte [10];
          // method call with large param
          // method call with small param
          // takes just as long as the earlier call
Because of this bug, the second call to CServer.Exec takes as long as the first call, although the parameter is smaller.


Article ID: 327782 - Last Review: October 26, 2013 - Revision: 3.5
  • Microsoft .NET Framework 1.0 Service Pack 1
  • Microsoft .NET Framework 1.0 Service Pack 2
kbnosurvey kbarchive kbhotfixserver kbqfe kbbug kbfix kbnetframe100presp3fix kbqfe KB327782

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from