Microsoft KB Archive/322630

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

Article ID: 322630

Article Last Modified on 7/30/2007

-

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
 * Microsoft Visual Studio .NET 2003 Enterprise Developer
 * Microsoft Visual Studio .NET 2003 Professional Edition
 * Microsoft Visual Studio .NET 2003 Academic Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Academic Edition
 * Microsoft Visual C# .NET 2003 Standard Edition
 * Microsoft Visual C# .NET 2002 Standard Edition
 * Microsoft Visual Basic .NET 2003 Standard Edition
 * Microsoft Visual Basic .NET 2002 Standard Edition

-



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 &quot;Symptoms&quot; 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 &quot;Symptoms&quot; section occurs.



RESOLUTION
To resolve this problem, use the four compile-time attributes that are mentioned in the &quot;Symptoms&quot; 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.



Steps to Reproduce the Behavior
 Start Microsoft Visual Studio .NET. 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. In the MyClassLibrary project, add a reference to the System.EnterpriseServices.dll .NET assembly.  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  _ Public Class Class1 Inherits ServicedComponent Shared Sub Main End Sub End Class </li> At a Visual Studio .NET command prompt, run the following command to create a strong name:

Sn -k C:\Key.snk

</li>  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 </li>  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 </li>  If you are using Visual C# .NET, locate the following code in the AssemblyInfo.cs file of the MyClassLibrary project: [assembly: AssemblyKeyFile(&quot;&quot;)] If you are using Visual Basic .NET, locate the following code in the AssemblyInfo.vb file of the MyClassLibrary project: <Assembly: AssemblyVersion(&quot;1.0.*&quot;)> </li>  If you are using Visual C# .NET, replace the code that you located in step 8 with the following code: [assembly: AssemblyKeyFile(&quot;C:\\Key.snk&quot;)] [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(&quot;C:\Key.snk&quot;)> <Assembly: ApplicationAccessControl(True)> </li> Build the MyClassLibrary project to create the MyClassLibrary.dll assembly.</li> 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.</li> 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 </li> Start the Component Services console.</li> Locate the MyCOM+App COM+ application that you registered with the COM+ catalog in step 12, and then expand the application.</li> Under MyCOM+App, expand Components.</li> 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.</li> 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.</li> Try to use Just-in-Time Activation functionality of the MyCOM+App COM+ application.

The application still supports Just-in-Time Activation functionality.</li></ol>

<div class="references_section">