question

RahulA-6581 avatar image
0 Votes"
RahulA-6581 asked ·

Need to get the Current Biztalk Application Name

HI,

I need to get the current Biztalk Application name under which my Custom Disassembler is running.
With the below code, I get all the applications list.

Is there any way for me to get only the application under which my code(Custom disassembler code) is running.

BtsCatalogExplorer catalog = new BtsCatalogExplorer();
catalog.ConnectionString = "SERVER=.;DATABASE=BizTalkMgmtDb;Integrated Security=SSPI";

         //string applicationName = args[1];
         ApplicationCollection app = catalog.Applications;


67104-b1.png


biztalk-server-all
b1.png (25.4 KiB)
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

JonasGrundn-4741 avatar image
0 Votes"
JonasGrundn-4741 answered ·

I'm working with the same thing myself right now so I can only point you in the right direction.

"Application Name" is not a promoted property but other are promoted in your application.

You'll need the:
1. connection string to your BizTalk Management Db, for example:

         conn = "Data Source=localhost;Initial Catalog=BiztalkMgmtDb;Integrated Security=SSPI"
  1. Get a promoted property in your application:

             if (inmsg.Context.Read("PortName", BTS_MSG_TRACKING_NAMESPACE) != null)
                  portName = inmsg.Context.Read("PortName", BTS_MSG_TRACKING_NAMESPACE) as string;
    
  2. Usage of BtsCatalogExplorer located in Microsoft.BizTalk.ExplorerOM:

           BtsCatalogExplorer bc = new BtsCatalogExplorer();
             bc.ConnectionString = conn;
    
             foreach (ReceivePort receivePort in bc.ReceivePorts)
             {
                 if (portName == receivePort.Name)
                 {
                     applicationName = receivePort.Application.Name;
                 }
             }
    

Note: If your code will run on multiple machines, you'll need to find the db server and instance name for each machine. Use the RegistryKey class in Microsoft.Win32 to extract your connection string data from
HKEY_CURRENT_USER\SOFTWARE\Microsoft\BizTalk Server\3.0\Tracking
MgmtDBServer

Edit:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\BizTalk Server\3.0\Administration\MgmtDBServer
might be a better path.


· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Awesome!!

Thanks a lot :)


I am facing another issue, which nothing to do with this. May be you already crossed the scenario and have some solutions or may be you can guide me to in the right path please.
Thank you!

https://docs.microsoft.com/en-us/answers/questions/297669/using-btdf-framework-can-i-deploy-2-apps-using-sam.html

0 Votes 0 ·