5

I have a COM+ component on a server (Windows Server 2003). Is there any way I can programmatically retrieve the properties of this component, (e.g. the constructor string used)?

When I go to Administritive Tools -> Component Services -> COM+ Applications and right click on my component, these are the properties I want to be able to retrieve and write to a file.

Is there any way I can do this?

Thanks in advance.

4

1 回答 1

7

您可以使用COM+ Administration API来检索组件的属性。可以在此处找到您可以检索的各种集合。在 Visual Studio 中,您将添加对COM+ 1.0 Admin Type Library. 基本上你会做类似的事情(未经测试):

COMAdminCatalogCollection applications;
COMAdminCatalog catalog;

catalog = new COMAdminCatalog();
applications = (COMAdminCatalogCollection)catalog.GetCollection("Applications");
applications.Populate();

foreach(COMAdminCatalogObject application in applications)
{
    //do something with the application
    if(  application.Name.Equals("MyAppName") )
    {
        COMAdminCatalogCollection components;
        components = applications.GetCollection("Components", application.Key)

        foreach(COMAdminCatalogObject component in components)
        {
            // do something with component
        }
    }

}
于 2010-06-30T20:15:15.827 回答