In the sequence of my last two posts (here and here) and following the same topic, in order to finalize it, let’s talk about the last option and see how we can accomplish the same goal, but this time by configuring the Send Handler for existing static Send Ports in your environment.
Well, the two previous posts are, in my opinion, more critical than this one for the simple reason that the default BizTalk installation will have ports in your environment that need to be configured if you want to configure BizTalk Host in a High Availability way, i.e., dedicate logical hosts to run specific areas of functionality such as receiving messages, sending messages, processing orchestrations or tracking data.
📝 One-Minute Brief
This post shows how to configure the default send handler for all existing static send ports in BizTalk Server using PowerShell. It addresses common issues caused by default configurations (such as ESB Toolkit installations) and demonstrates how automation simplifies host and adapter handler alignment across environments.
However, although less critical, static send ports can also be a problem in some scenarios, for example:
- If you install ESB Toolkit before configuring your hosts for each functionality, because during the ESB Toolkit installation, a static send port called ALL.Exceptions will also be created that connect with the SQL EsbExceptionDb database. And this port will be configured with the default send handler (at that time) configured in your environment, that is, by default, the BizTalkServerApplication.
- But also, if you reach an existing environment already containing several BizTalk Applications running, that is not configured according to best practices for hosts and host instances (dedicate logical hosts to each functionality).
Once again, we need to do basically the same steps described in my last two posts to accomplish the task of deleting “BizTalkServerApplication”, this time as a send handler of each adapter:
- Manually reconfigure the Send handler for each existing Static Send Port first, setting it to the new or correct Send Handler.
- and then manually delete the BizTalkServerApplication as a Send handler for each adapter.
You may have heard this before, but it never hurts. All of these tasks are time-consuming and a little boring to do after a while, or if we need to do them several times.
So how can we automate tasks? and reuse them whenever necessary, and at the same time save significant time for other tasks?
Using PowerShell is a good option :). Windows PowerShell is a Windows command-line shell designed especially for system administrators and can be used by BizTalk administrators to help them automate repetitive tasks or tasks that are time-consuming to perform manually.
This is a simple script that allows you to configure the Send handler associated with all the existing Static Send Ports in your environment independently of the adapter that is configured:
$catalog = New-Object Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer
$catalog.ConnectionString = "SERVER=$bizTalkDbServer;DATABASE=$bizTalkDbName;Integrated Security=SSPI"
foreach($SendPort in $catalog.SendPorts)
{
# For each receive location in your environment
if($sendPort.IsDynamic -eq $False)
{
# Let's look for send handlers associated with Adapter configured in the send port
foreach ($handler in $catalog.SendHandlers)
{
# if the Send Handler is associated with the Adapter configured in the send port
if ($handler.TransportType.Name -eq $sendPort.PrimaryTransport.TransportType.Name)
{
# We will configured the port with the default send handler associated in each adapter in you system
# independently if it is "BizTalkServerApplication" or not.
# Note: it's is recomended that you first configure the default send handlers for each adapter
# and also not to use the "BizTalkServerApplication" (my personal recomendation)
if($handler.IsDefault)
{
$sendPort.PrimaryTransport.SendHandler = $handler
break
}
}
}
}
}
$catalog.SaveChanges()
Prerequisites for this script: The host, host instances, and receive handlers need to be already configured in your environment before you run the script.
Download
THIS POWERSHELL IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.
You can download PowerShell to Configure the Default Send Handler for each static Send Port from GitHub here:
Hope you find this helpful! If you liked the content or found it useful and would like to support me in writing more, consider buying (or helping to buy) a Star Wars Lego set for my son.