PRB: Some Functionalities of a COM+ Application Do Not Change If You Change the Corresponding Settings in the COM+ Catalog (322630)



The information in this article applies to:

  • Microsoft Enterprise Services (included with the .NET Framework 1.1)
  • Microsoft Enterprise Services (included with the .NET Framework) 1.0
  • Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2003), Professional Edition
  • Microsoft Visual Studio .NET (2003), Academic Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2002), Professional Edition
  • Microsoft Visual Studio .NET (2002), Academic Edition
  • Microsoft Visual C# .NET (2003)
  • Microsoft Visual C# .NET (2002)
  • Microsoft Visual Basic .NET (2003)
  • Microsoft Visual Basic .NET (2002)

This article was previously published under Q322630

SYMPTOMS

When you change the settings for a COM+ application in the COM+ catalog, the corresponding functionalities of the application do not change. For example, after you use the JustInTimeActivation compile-time attribute in your code to enable Just-in-Time Activation functionality for a COM+ application and then you click to clear the corresponding Enable Just In Time Activation check box in the Component Services administrative tool, the application still supports Just-in-Time Activation functionality.

This problem affects only those settings in the Component Services administrative tool that correspond to the following compile-time attributes:
  • AutoComplete
  • JustInTimeActivation
  • ObjectPooling
  • SecureMethod

CAUSE

The four compile-time attributes that are mentioned in the "Symptoms" section of this article establish some of the functionalities of a COM+ application. The Microsoft .NET Framework reads these attributes from the metadata of the application instead of from the corresponding settings in the COM+ catalog. The corresponding settings in the COM+ catalog exist only for informational purposes. If you change these settings, your change does not affect the corresponding functionalities of the application. Therefore, the behavior that is mentioned in the "Symptoms" section occurs.

RESOLUTION

To resolve this problem, use the four compile-time attributes that are mentioned in the "Symptoms" section in your code instead of changing the corresponding settings in the COM+ catalog. If you use these attributes in your code, you can control the functionality of your COM+ application.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Start Microsoft Visual Studio .NET.
  2. Use Microsoft Visual C# .NET or Microsoft Visual Basic .NET to create a Class Library project that is named MyClassLibrary.

    By default, the Class1.cs file is created in Visual C# .NET or the Class1.vb file is created in Visual Basic .NET.
  3. In the MyClassLibrary project, add a reference to the System.EnterpriseServices.dll .NET assembly.
  4. If you are using Visual C# .NET, replace the existing code in the Class1.cs file with the following code:
    using System.EnterpriseServices;
    [JustInTimeActivation]
    public class Class1 : ServicedComponent
    {
    	static void Main()
    	{}
    }
    If you are using Visual Basic .NET, replace the existing code in the Class1.vb file with the following code:
    Imports System.EnterpriseServices
    <JustInTimeActivation()> _
    Public Class Class1
       Inherits ServicedComponent
       Shared Sub Main()
       End Sub
    End Class
  5. At a Visual Studio .NET command prompt, run the following command to create a strong name:

    Sn -k C:\Key.snk

  6. If you are using Visual C# .NET, locate the following code in the AssemblyInfo.cs file of the MyClassLibrary project:
    using System.Runtime.CompilerServices;
    If you are using Visual Basic .NET, locate the following code in the AssemblyInfo.vb file of the MyClassLibrary project:
    Imports System.Runtime.InteropServices
  7. If you are using Visual C# .NET, add the following code after the code that you located in step 6:
    using System.EnterpriseServices;
    If you are using Visual Basic .NET, add the following code after the code that you located in step 6:
    Imports System.EnterpriseServices
  8. If you are using Visual C# .NET, locate the following code in the AssemblyInfo.cs file of the MyClassLibrary project:
    [assembly: AssemblyKeyFile("")]
    If you are using Visual Basic .NET, locate the following code in the AssemblyInfo.vb file of the MyClassLibrary project:
    <Assembly: AssemblyVersion("1.0.*")>
  9. If you are using Visual C# .NET, replace the code that you located in step 8 with the following code:
    [assembly: AssemblyKeyFile("C:\\Key.snk")]
    [assembly: ApplicationAccessControl(true)]
    If you are using Visual Basic .NET, add the following code after the code that you located in step 8:
    <Assembly: AssemblyKeyFile("C:\Key.snk")>
    <Assembly: ApplicationAccessControl(True)>
  10. Build the MyClassLibrary project to create the MyClassLibrary.dll assembly.
  11. At the Visual Studio .NET command prompt, change the directory path to the location of the MyClassLibrary.dll assembly that you built in step 10.
  12. At the Visual Studio .NET command prompt, run the following command to register the MyClassLibrary.dll assembly with the COM+ catalog as a COM+ application that is named MyCOM+App:

    regsvcs /appname:MyCOM+App MyClassLibrary.dll
  13. Start the Component Services console.
  14. Locate the MyCOM+App COM+ application that you registered with the COM+ catalog in step 12, and then expand the application.
  15. Under MyCOM+App, expand Components.
  16. If you are using Visual C# .NET, right-click Class1 under Components, and then click Properties.

    If you are using Visual Basic .NET, right-click MyClassLibrary.Class1 under Components, and then click Properties.
  17. If you are using Visual C# .NET, click the Activation tab of the Class1 Properties dialog box, click to clear the Enable Just In Time Activation check box, and then click OK.

    If you are using Visual Basic .NET, click the Activation tab in the MyClassLibrary.Class1 Properties dialog box, click to clear the Enable Just In Time Activation check box, and then click OK.
  18. Try to use Just-in-Time Activation functionality of the MyCOM+App COM+ application.

    The application still supports Just-in-Time Activation functionality.

Modification Type:MinorLast Reviewed:7/8/2005
Keywords:kbService kbSecurity kbJIT kbcomplusobj kbCOMPlusCatalog kbProgramming kbMiscTools kbSysAdmin kbSample kbcode kbprb KB322630 kbAudDeveloper