如何以编程方式设置COM +组件 - >交易不支持?

时间:2014-01-03 11:36:19

标签: windows perl vbscript jscript com+

我正在寻找以编程方式修改Com + Component Property的解决方案 - >对“不支持”的交易支持

手动步骤如下:

  1. 打开Component Services对话框(comexp.msc
  2. 展开Component Services - > Computers - > My Computer
  3. 查找并展开COM+ QC Dead Letter Queue Listener
  4. 在已打开的组件内展开文件夹Components
  5. 查找组件QC.DLQListener并打开此组件的上下文菜单,然后选择属性
  6. 在“属性”屏幕上,选择“交易”标签,然后将Transactions Support设置为Not Supported
  7. 点击“确定”保存更改
  8. enter image description here

1 个答案:

答案 0 :(得分:1)

在我花了几个小时来解决这个问题之后,我终于得到了一个关于C#的解决方案。

我从以下文章中获得了很多见解:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using COMAdmin;

namespace SetComPlusTransactionsToNotRequired
{
    class Program
    {
        static void Main(string[] args)
        {
            COMAdminCatalog catalog;
            COMAdminCatalogCollection applications;

            // Get the catalog
            catalog = new COMAdminCatalog();

            // Get the list of all COM+ applications contained within this catalog
            applications = (COMAdminCatalogCollection)catalog.GetCollection("Applications");
            applications.Populate();

            foreach (COMAdminCatalogObject application in applications)
            {
                if (application.get_Value("Name") == "COM+ QC Dead Letter Queue Listener")
                {
                    COMAdminCatalogCollection components;
                    components = (COMAdminCatalogCollection)applications.GetCollection("Components", application.Key);
                    components.Populate();

                    foreach (COMAdminCatalogObject component in components)
                    {
                        Console.WriteLine("Component: " + component.Name);
                        component.set_Value("Transaction", COMAdminTransactionOptions.COMAdminTransactionNone);
                    }
                    components.SaveChanges();
                }
            }
        }
    }
}