C# - 检索 COM 的属性成分?

发布于 2024-09-07 21:32:24 字数 194 浏览 9 评论 0原文

我的服务器 (Windows Server 2003) 上有一个 COM+ 组件。有什么方法可以以编程方式检索该组件的属性(例如使用的构造函数字符串)?

当我转到管理工具 -> 时组件服务-> COM+ 应用程序并右键单击我的组件,这些是我希望能够检索并写入文件的属性。

我有什么办法可以做到这一点吗?

提前致谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓝眸 2024-09-14 21:32:24

您可以使用 COM+ Administration API 检索组件的属性。您可以在此处找到可以检索的各种集合。在 Visual Studio 中,您可以添加对 COM+ 1.0 管理类型库 的引用。本质上你会做类似的事情(未经测试):

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
        }
    }

}

You can use the COM+ Administration API to retrieve the properties of a component. The various collections you can retrieve can be found here. From visual studio you would add a reference to the COM+ 1.0 Admin Type Library. Essentially you would then do something like (not tested):

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
        }
    }

}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文