BizTalkのコードをオンまたはオフに受信場所回す自動化する方法はありますか?

StackOverflow https://stackoverflow.com/questions/1515305

  •  19-09-2019
  •  | 
  •  

質問

のBizTalkで受信場所にかのオフを自動化する方法はありますか?この種のもののためのAPIのいくつかの種類またはそのようないくつかのがあるべきように思えます。私はC#で働くことを好むだろうが、WMIまたはスクリプトのいくつかの種類があまりにも動作します。

役に立ちましたか?

解決

あなたが出て見つけたとして

ExplorerOMのほかに、あなたも無効には、受信場所(とポートを送信制御)/有効にすることができますWMIを使用します。

私はそれらのことを行う方法を示すサンプルPowerShellスクリプト<のhref =「http://github.com/tomasr/bts-ps-scripts/blob/master/bts-ports.ps1」のrel =」を持っていますnoreferrer ">ここを、もし興味があるなら。

他のヒント

私は解決策を見つけました。 Microsoft.BizTalk.ExplorerOM.dllは私が欲しかったものであることが表示されます。

:ここでは誰が始める必要があるのBizTalkドキュメントからの抜粋です
using System;
using Microsoft.BizTalk.ExplorerOM;
public static void EnumerateOrchestrationArtifacts()
{
    // Connect to the local BizTalk Management database
    BtsCatalogExplorer catalog = new BtsCatalogExplorer();
    catalog.ConnectionString = "Server=.;Initial Catalog=BizTalkMgmtDb;Integrated Security=SSPI;";

    // Enumerate all orchestrations and their ports/roles
    Console.WriteLine("ORCHESTRATIONS: ");
    foreach(BtsAssembly assembly in catalog.Assemblies)
    {
        foreach(BtsOrchestration orch in assembly.Orchestrations)
        {

            Console.WriteLine(" Name:{0}\r\n Host:{1}\r\n Status:{2}",
                orch.FullName, orch.Host.Name, orch.Status);

            // Enumerate ports and operations
            foreach(OrchestrationPort port in orch.Ports)
            {
                Console.WriteLine("\t{0} ({1})", 
                    port.Name, port.PortType.FullName);

                foreach(PortTypeOperation operation in port.PortType.Operations)
                {
                    Console.WriteLine("\t\t" + operation.Name);
                }
            }

            // Enumerate used roles
            foreach(Role role in orch.UsedRoles)
            {
                Console.WriteLine("\t{0} ({1})", 
                    role.Name, role.ServiceLinkType);

                foreach(EnlistedParty enlistedparty in role.EnlistedParties)
                {
                    Console.WriteLine("\t\t" + enlistedparty.Party.Name);
                }
            }

            // Enumerate implemented roles
            foreach(Role role in orch.ImplementedRoles)
            {
                Console.WriteLine("\t{0} ({1})", 
                    role.Name, role.ServiceLinkType);
            }
        }
    }
}

1つの警告、どうやらこのDLLは64ビットをサポートしていません。私は簡単なユーティリティを書いていますので、それが(ちょうど32ビットとしてコンパイル)私にとっては大したことではないのですが、注意すべきものです。

あなたが解決策を見つけたように見えることを確認するために喜んでます。

また、様々な状況にのBizTalkアーティファクトを設定するためのPowershell、ExplorerOM、とBizTalk APIを使用している同様の選択肢を言及したいと思った。

そのうちの一つである場所を受信します。

スクリプトは、成果物をリストアップして、あなたがそれらを設定するためにどのような状態にしたいと思います。XML設定ファイルを、受け入れる

スクリプトは、Microsoftスクリプトセンターに公開されています: http://gallery.technet.microsoft.com/scriptcenter/Set-Artifact -Status-270f43a0する

Alhambraeidosコメントに応えて。

:ここで私はリモートで受信場所を無効にするには、Windowsのアプリケーションで使用されるコードの一部抜粋されます
    /// <summary>
    /// Gets or sets the biz talk catalog.
    /// </summary>
    /// <value>The biz talk catalog.</value>
    private BtsCatalogExplorer BizTalkCatalog { get; set; }

    /// <summary>
    /// Initializes the biz talk artifacts.
    /// </summary>
    private void InitializeBizTalkCatalogExplorer()
    {
        // Connect to the local BizTalk Management database
        BizTalkCatalog = new BtsCatalogExplorer();
        BizTalkCatalog.ConnectionString = "server=BiztalkDbServer;database=BizTalkMgmtDb;integrated security=true";
    }


    /// <summary>
    /// Gets the location from biz talk.
    /// </summary>
    /// <param name="locationName">Name of the location.</param>
    /// <returns></returns>
    private ReceiveLocation GetLocationFromBizTalk(string locationName)
    {
        ReceivePortCollection receivePorts = BizTalkCatalog.ReceivePorts;
        foreach (ReceivePort port in receivePorts)
        {
            foreach (ReceiveLocation location in port.ReceiveLocations)
            {
                if (location.Name == locationName)
                {
                    return location;
                }
            }
        }

        throw new ApplicationException("The following receive location could not be found in the BizTalk Database: " + locationName);
    }


    /// <summary>
    /// Turns the off receive location.
    /// </summary>
    /// <param name="vendorName">Name of the vendor.</param>
    public void TurnOffReceiveLocation(string vendorName)
    {
        ReceiveLocation location = Locations[vendorName].ReceiveLocation;
        location.Enable = false;
        BizTalkCatalog.SaveChanges();
    }

私は「場所」と呼ばれる場所を受けるの辞書を作成していたように私は、取り残さいくつかがあることに気づくでしょうが、あなたのアイデアを得ることができるはずです。パターンはかなりあなたと対話したいのBizTalkオブジェクトに対して当てはまります。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top