1

コンポーネントサービス->コンピューター->マイコンピューター->COM+アプリケーション

COM+アプリケーションオブジェクトを開きます。

コンポーネントを開きます。

クラスを右クリックして、[プロパティ]を選択します。

[詳細設定]の下に、[IIS固有のプロパティを許可する]のチェックボックスがあります。

このチェックボックスをプログラムでチェックするにはどうすればよいですか?

プログラムでCOM+アプリケーションを作成および削除できますが、ComApplicationクラスには、作成されたアプリケーションの設定を変更する方法がないようです。

4

2 に答える 2

3

やり方がわかった。

どうやら、COM+ アプリケーションのコレクションを取得し、必要なものを (名前で) 見つけてから、アプリケーション内のコンポーネントのコレクションを取得し、コレクションを調べて属性を設定する必要があるようです。

            //get collection of applications
        COMAdminCatalog catalog = new COMAdminCatalog();

        catalog.Connect("127.0.0.1");

        COMAdminCatalogCollection applications = (COMAdminCatalogCollection)catalog.GetCollection("Applications");

        applications.Populate(); //no idea why that is necessary, seems to be

        // appId for the application we are looking for
        object appId = new object();

        int count = applications.Count;
        ICatalogObject item;

        if (count == 0) return;

        //search collection for item with name we are looking for
        for (int i = 0; i < count; i++)
        {

            item = (ICatalogObject)applications.get_Item(i);

            if (applicationName == (string)item.get_Value("Name"))
            {

                appId = item.Key;

                Console.WriteLine("appId found for " + applicationName + ": " + appId.ToString());

            }

        }

        // get all components for the application
        COMAdminCatalogCollection components;

        components = (COMAdminCatalogCollection)applications.GetCollection("Components", appId);
        components.Populate(); // again, no idea why this is necessary

        // set the attribute in all components

        foreach (COMAdminCatalogObject component in components)
        {

            Console.WriteLine("Setting IISIntrinsics attribute in " + component.Name + ".");
            component.set_Value("IISIntrinsics", true);
            components.SaveChanges();

        }

これは、より少ないキャストでより良くできると思います。しかし、方法がわかりません。

これで十分です。

于 2008-12-02T17:14:40.790 に答える
0

この特定のプロパティについては経験がありませんが、MSDNに記載されているようです。

于 2008-12-02T15:49:45.423 に答える