Posts Tagged ‘BizTalk’

Microsoft just releases two cumulative update packages for BizTalk 2013: Cumulative Update Package 2 for BizTalk Server 2013 and Cumulative Update Package 1 for BizTalk Adapter Pack 2013!

Cumulative update package 2 for BizTalk Server 2013

Cumulative update package 2 for Microsoft BizTalk Server 2013 contains hotfixes for the BizTalk Server 2013 issues that were resolved after the release of BizTalk Server 2013.

Important notes about the cumulative update package

  • It’s recommend that you test hotfixes before you deploy them in a production environment.
  • The cumulative update package is a unified package that contains x86 and x64 files. To install the update, run the Setup.exe file.

List of hotfixes that are included in cumulative update package 2 for BizTalk Server 2013:

  • FIX: The value for the "maxOccurs" attribute is invalid when you validate the BizTalk X12 EDI 835 schema in a BizTalk EDI application in BizTalk Server 2013 (KB 2777584)
  • FIX: The memory that a BizTalk host process consumes increases when there are no messages in the queue in BizTalk Server 2013 (KB 2823757)
  • FIX: Pipeline on receive locations reverts to pass-through after you update the schema assembly in BizTalk Server 2013 (KB 2802453)
  • FIX: "The InnerText property is write only" error message when you use System.Xml.XmlDocument in BizTalk Server 2013 (KB 2835689)
  • FIX: "Could not load file or assembly ‘Microsoft.BizTalk.Interop.SSOClient Version=5.0.1.0" error when you use the ESB configuration tool in BizTalk Server 2013 (KB 2848425)
  • FIX: SQL connection leak when you use WCF-based SQL Adapter one-way send port to return a result set from a database in BizTalk Server 2013 (KB 2855762)
  • FIX: 2-way WCF-BasicHttp receive port does not respond to a WCF client when the "failed message routing" feature is enabled in BizTalk Server 2013 (KB 2813294)
  • FIX: Message is suspended when you try to receive an encrypted AS2 message together with asynchronous MDN in BizTalk Server 2013 (KB 2778133)
  • An update for Message Box Viewer is available in Microsoft BizTalk Server 2013 cumulative update 2 (KB 2885488)
  • FIX: Support for HIX EDI transactions 005010×306 (820) and 005010×220 (834) for BizTalk Server 2013 (KB 2882453)
  • FIX: XpathMutatorStream class does not work as expected when you execute Xpath statements against XmlDocuments in BizTalk Server 2013 (KB 2851429)
  • FIX: BizTalk Server 2013 cannot receive the messages from the view in document library or from the SharePoint online library (KB 2859398)
  • FIX: High CPU usage after you install BizTalk Server 2013 and SQL Server 2012 on a computer (KB 2891320)
  • FIX: "System.ArgumentException" error when you browse WCF services from ESB Toolkit 2.2 in BizTalk Server 2013 (KB 2849475)
  • ESB Toolkit BRE Itinerary Resolver Fails with Exception (KB 2887594)

Restart requirement

You have to restart the computer after you apply this cumulative update package.

Prerequisites

To apply this cumulative update package, you must have BizTalk Server 2013 installed:

  • Microsoft BizTalk Server 2013 Developer
  • Microsoft BizTalk Server 2013 Enterprise
  • Microsoft BizTalk Server 2013 Standard

To know more about and download this CU2 check Microsoft Help and Support.

Cumulative update package 1 for BizTalk Adapter Pack 2013

This cumulative update for BizTalk Adapter Pack 2013 contains hotfixes for BizTalk Adapter Pack 2013 issues that were fixed after the release of BizTalk Adapter Pack 2013.

Important notes about the cumulative update package

  • It’s recommend that you test hotfixes before you deploy them in a production environment.
  • The cumulative update package includes all component updates. However, the cumulative update package updates only those components that are installed on the system.
  • The cumulative update package is a unified package that contains x86 and x64 files.

List of hotfixes that are included in cumulative update package 1 for BizTalk Adapter Pack 20103:

  • FIX: Package variables trigger operations fail when you use BizTalk Adapter for Oracle Database to connect to Oracle Database (KB 2845542)
  • FIX: "Column ‘PROVIDERTYPE’ does not belong to table SchemaTable" exception when you use BizTalk Adapter for Oracle Database to connect to an Oracle database (KB 2845538)
  • FIX: Messages become stuck in SM58 when you use a WCF-based SAP Adapter in BizTalk Server (KB 2845536)
  • FIX: WCF-SAP adapter receive location freezes under heavy load when it works as a tRFC server (KB 2836739)

Restart requirement

You have to restart the computer after you apply this cumulative update package.

Prerequisites

To apply this cumulative update package, you must have BizTalk Adapter Pack 2013 installed.

To know more about this CU2 check Microsoft Help and Support.

 

As previously described, you may have to restart the computer after you apply both cumulative update packages.

Today I want to talk about a very common problem that can occur when we are invoking BizTalk Orchestrations exposed as a synchronous services (Request-Response Receive ports):

"System.Net.WebException: The operation has timed out"

System-Net-WebException-The-operation-has-timed-out-BizTalk-Orchestration

In my case I was trying to invoke an orchestration exposed as a WCF service. And of course this can be very straightforward problem, most of the times easy to detect and probably also to fix… but sometimes BizTalk tries to play with us and throw a few good surprises…

TYPICAL CAUSES AND SOLUTIONS

Typically this problem is usually associated with network problems or lack of Error Handling inside Orchestrations:

  • You are trying to invoke an external system inside the orchestration and it take too much time to respond and naturally we get a time out error.
    • The SOAP.ClientConnectionTimeout property can be used on a Web service that take a long time to return a response to try to solve or address this problem. See more here.
  • You can have a High Volume of request and you can overload the external service with too many concurrent calls or you can have limits of max connections to a certain address and will naturally this can cause affect the performance and provably will take too much time to respond.
  • This error can also occur when the BizTalk performance get degraded and it start responding slow. If the BizTalk jobs are not well configured and running the size of BizTalk Databases can grow extremely and responding very slow and we get stuck with this error.
    • You need to validate the jobs and the database and if necessary you need to configure the jobs and clean the databases with the Terminator tool and provably shrinking also the databases to resolve the problem.
  • Also you can get this error because you don’t want to handler errors inside orchestrations, so for example if you don’t handler WCF Fault messages from your external service or you are invoking a C# code and it raise an exception, and you are note handling this situations in your orchestration, the orchestration will be suspended an you will get a timed out exception.
Nothing fit in the problem. What can it be?

But … and when all this is checked and doesn’t fit in the problem that is happening. What can it be? Before explain let me describe my scenario:

  • I have a simple demo service that receive a small message, invoke an external service and return the message to the source system.
  • Because of API limitation I decide to invoke this external services with C# and control Exception inside orchestrations.
  • I know by using HAT and debugging in DEV environment that the external service was giving me a known error that I was controlling and throwing the error in order to create a response with the error description, inside the orchestration, to be returned to the original system.

So nothing to fancy and very simple stuff. However every time I tried to test the orchestration the orchestration was stuck in the message box in suspended state… the external service was invoked, the error was catch in the code, logged and the exception was raised for the orchestration and after that nothing … the engine seemed unaware and did not understand what was happening, crazy I know.

0XC0C01B52-Orchestration-Engine-Error

When I investigated the Event Viewer to try to find more information I found this description:

xlang/s engine event log entry: Uncaught exception (see the ‘inner exception’ below) has suspended an instance of service ‘MyOrchestration(728766c9-9df2-609b-004e-fa2e7c3079c4)’.
The service instance will remain suspended until administratively resumed or terminated.
If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.
InstanceId: 4dfd6041-d52f-4110-8d0d-92efc48f0c38
Shape name: InvokeExternalService Shape
ShapeId: eff276fd-f289-4778-ba47-ff66309ae8c6
Exception thrown from: segment 2, progress 8
Inner exception: Fault Response: My Error Description

The first thing I thought was that I incorrectly published some resource (DLL) … but after validating and publishing the solution again, the problem prevailed.

CAUSE

The Orchestration Designer can play some tricks to developers. And be very careful when you copy shapes from one orchestration to others!

What I did was open a similar solution and copy the main scope (body of the orchestration) to a new solution that I had created. This will also copy all the shapes inside the scope… and of course I change the shapes to fit my new requirements, by deleting some shapes and change the code inside others… Why? To be faster and not lose much time creating the main sketch of the orchestration.

But be aware that the Orchestration design don’t like some of this operations (for me it’s a bug inside Orchestration design), and for some reason the designer doesn’t interpret well the shapes (“refactoring” or the “graphical interpretation”). He compile when the solution but in runtime we get stuck with the error “The service instance will remain suspended until administratively resumed or terminated. If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.”

I don’t know if some also detect this behavior before but I already experience this twice.

SOLUTION

To solve this strange behavior you need to redesign the same Orchestration flow by:

  • Dragging new shapes to the Orchestration design and copy the exact same code inside the existing shapes to the new ones… you can also give the same names!
  • At the end delete the existing shapes (which had been copied).
  • Compile and deploy the project again.

Without doing anything more this solved my problem.

And finally the BizTalkCrew 2013 tour is over! Like last year this was a European tour that started in London (UK) with our BizTalk Summit 2013 with an astounding audience of 128 attendees from more than 70 different companies across 16 countries. Then for the first time we held the event in the beautiful city of Oporto (Portugal) – Oporto BizTalk Innovation Day, a very special event for me because I was the host of the event and that for the first time I was able to bring BizTalk product group to Portugal.

And in the last two month the BizTalkCrew has been very active and busy planning and organizing the end of the 2013 European tour with two new BizTalk Innovation Day.

Bouvet BizTalk Innovation Day 2013

The first event, Bouvet BizTalk Innovation Day 2013, was a two day event (26 and 27 of September) held for the second time in Stavanger (Norway) and besides having the usual suspects (the BizTalkCrew: me, Steef-Jan Wiggers, Nino Crudele, Saravana Kumar and Tord G. Nordahl) as speakers, the event had two distinguished special guests: Microsoft Integration MVP Kent Weare and Microsoft Windows Azure Customer Advisory the infamous Paolo Salvatori.

This was the biggest BizTalk event organized in Norway this year with a total of 70 people attended this two days event.

Bouvet-BizTalk Innovation-Days 2013-Attendes

The first day was filled with presentations made by the speakers:

  • The first session was MVP Kent Weare talking about how you can expose Line of Business (LOB) services to mobile devices using BizTalk 2013 and the Azure Service Bus.
  • The second was MVP Steef-Jan Wiggers talking about how you can learn to leverage BizTalk Server 2013 and Windows Azure Service Bus to create hybrid solutions.
  • And in the last session of the morning, Paolo Salvatori took the stage to make the Key Notes about BizTalk 2013.
  • MVP Saravana Kumar took the stage in the first session of the afternoon to talk about Management and Monitoring of BizTalk Server using BizTalk360 and to raise the curtain for the first time in public and show some screens of the new version of the product in HTML5.
  • The fifth session was made by myself talking about BizTalk Mapping Patterns and Best Practices. Because this was a two day event I thought I’d take advantage of the first day just to make a theoretical presentation without demos, trying not only to explain how maps are processed internally by the engine of the product and describe some common mapper problems and solutions, but also try to recall some of the main basic concepts of maps because, most times, over the years and the experience acquired even the most experienced developer begins to carry malpractice and forget to apply the most basic concepts.
  • MVP Tord Nordahl took the stage after my session to talk about Proactivity in BizTalk by addressing some of the most important aspects to be aware in order for the enterprise to maintain a stable BizTalk environment.
  • And the final session was made by MVP Nino Crudele about BizTalk Hostage Situation – a set of good hostage BizTalk scenarios and how you can gain control of the situation and solve problems of bad implementations.

Bouvet-BizTalk Innovation-Days 2013-Nino-CrudeleBouvet-BizTalk Innovation-Days 2013-Paolo-SalvatoriBouvet-BizTalk Innovation-Days 2013-Sandro-Pereira

KentBouvet-BizTalk Innovation-Days 2013-Saravana-KumarBouvet-BizTalk Innovation-Days 2013-Steef-Jan

This day ended up with an awesome dinner with the attendees and the Bouvet staff, but only after a few hours of break with some beers and good talk with the attendees.

Bouvet-BizTalk Innovation-Days 2013-deaner

And like last year the second day was hands on labs, each speaker had his own room and hourly time slots, where the attendees could come in and had the opportunity to meet, discuss their issues, ask questions or share their experience with the speakers. I took this day to show 11 common mapping problems and explain the best way to address day and of course some of the best practices while we are developing maps. It was an amazing day with great conversation between the attendees and good feedback.

After the event has ended, unfortunately Saravana and Paolo Salvatori had to go back home, and Steef-Jan and Kent Weare when to Berlin to run the 40th Berlin Marathon (crazy guys!) but the rest of the team accompanied by Salvatore Pellitteri enjoyed themselves a little, visiting and getting to know Norway.

Bouvet-BizTalk Innovation-Days 2013-bergenBizTalk-Innovation-Day-Italy-2013-viking

You can download my presentation here.

BizTalk Innovation Day 2013 Italy

The second event, BizTalk Innovation Day 2013 Italy, was held in the Microsoft Innovation Campus in Milan (Italy). This was also the second time that the event was made in Italy and which also had the participation of two special guests: Microsoft Windows Azure Customer Advisory Paolo Salvatori and community member Salvatore Pellitteri.

BizTalk-Innovation-Day-Italy-2013-Microsoft

The agenda was very similar to the Norway event:

  • Once gain Steef-Jan had the privilege to start the event with his presentation about hybrid solutions.

BizTalk-Innovation-Day-Italy-2013-Steef-Jan

  • And was followed by Paolo Salvatori with an extension of the first session. This time Paolo talked about how you can use Windows Azure Service Bus, BizTalk Services, Mobile Services and BizTalk Server to create hybrid solutions.

BizTalk-Innovation-Day-Italy-2013-Paolo-Salvatori

  • Third session and to ended up the morning was Saravana Kumar with his presentation about Management and Monitoring of BizTalk Server using BizTalk360. But for the first time in public all of the demos were made in the last version of the product (V7).

BizTalk-Innovation-Day-Italy-2013-Saravana-Kumar

  • It was up to me to start the afternoon with my session about BizTalk Mapping Patterns and Best Practices. I reduced the slides to contain only the essential and most important information in order to be able to make a practice session. And I got it! Having enough time to show my 11 demos!

BizTalk-Innovation-Day-Italy-2013-Sandro-Pereira

  • After my session was once more Tord that took the stage to present his session about Proactivity in BizTalk.

BizTalk-Innovation-Day-Italy-2013-Tord

  • And responsibility to end the event with the final session was in the shoulders of Nino Crudele and Salvatore Pellitteri that held a presentation about real BizTalk environments in which they addressed several topics like new licensing system in BizTalk Server 2013 and productivity.

BizTalk-Innovation-Day-Italy-2013-Nino-and-Salvatori

After the event has ended the team enjoyed a little by visiting and getting to know Italy and eating amazing food.

BizTalk-Innovation-Day-Italy-2013-foodBizTalk-Innovation-Day-Italy-2013-Nino-Family

You can download my presentation here.

The speakers

For the Norway event is the usual group photo, starting from left to right with: Kent Weare, Tord Nordahl, Steef-Jan Wiggers, Saravana Kumar, Nino Crudele, Sandro Pereira (me) and Paolo Salvatori.

Bouvet-BizTalk Innovation-Days 2013-Speakers

And the same group picture in Italy with: Nino Crudele, Salvatore Pellitteri, Sandro Pereira (me), Tord Nordahl, Steef-Jan Wiggers and Saravana Kumar.

BizTalk-Innovation-Day-Italy-2013-speakers

2014?

What about 2014? Yes, we are already planning the 2014 BizTalk Innovation Tour!

Is it this year we make an event out of Europe? For now we are planning some events in Europe that will be announced soon… but It only depend on you :)

One of the principal needs for BizTalk Administrators is the ability to monitor the health of BizTalk environments and react promptly to possible problems, you can accomplished this by using certain tools such as: BizTalk Administration Console; BizTalk360; SCOM and many more… However, unfortunately many times, some of these tools are not available for us but we still need to accomplish this task.

Welcome back to this series of articles about Monitor your BizTalk environment using PowerShell that already have three previous editions:

Today we will talk about monitoring Windows Updates and Pending Restarts on the servers using PowerShell.

For me it’s very important that administrators deploy the latest Microsoft product updates to servers that are running the Windows operating system. By doing this they will address and solved known issues or vulnerabilities in Microsoft products and they will keep the environment constantly updated. However when we are working with several teams (system administrators, network administrator, BizTalk administrators and so on) or sometimes without system administrators teams this task normally are forgotten or postponed several times.

Although there are occasions when updates can cause a new issue to appear, generally speaking they will help solving problems. However, for this reason, you should install and tested this updates in developing or testing environment before you installed in production.

For this reasons I like to monitor and know if the servers that are running on my BizTalk environment has some updates available to install or for some reason they required a restart, so that I take actions without the need of constantly have to check this manually in all the servers.

So how can PowerShell help us?

With this script you can be able to monitoring Windows Updates and Pending Restarts on the servers running on your BizTalk environment using PowerShell. Servers that do not fall under these conditions will not be listed.

This script allows you to set:

  • A range of machines you need to monitor
#########################################################
# List of computers to be monitored
#########################################################
$Servers = Get-Content .\Machines.txt

The Machine.txt is a simple text file with the list of all machine names you want to monitor:
servername1.domain.local
servername2.domain.local
servername3.domain.local

  • And configure your email notification settings
#########################################################
# List of users who will receive the report
#########################################################
$mailto = "mail1@mail.net, mail2@mail.net"

#########################################################
# SMTP properties
#########################################################
$emailFrom = "suport@mail.net"
$smtpServer = "mySMTPServer" #SMTP Server.
$smtpUsername = "myUsername"
$smtpPassword = "myPassword"

The script will monitor all the servers with Windows Updates ready to be installed, Windows Updates configured to be checked manually or servers that required a reboot. Servers that do not fall under these conditions will not be listed.

$results = foreach ($Computer in $Servers)
{
	try
  	{
	  	$service = Get-WmiObject Win32_Service -Filter 'Name="wuauserv"' -ComputerName $Computer -Ea 0
		$WUStartMode = $service.StartMode
		$WUState = $service.State
		$WUStatus = $service.Status

		try{
			if (Test-Connection -ComputerName $Computer -Count 1 -Quiet)
			{
				#check if the server is the same where this script is running
				if($Computer -eq "$env:computername.$env:userdnsdomain")
				{
					$UpdateSession = New-Object -ComObject Microsoft.Update.Session
				}
				else { $UpdateSession = [activator]::CreateInstance([type]::GetTypeFromProgID("Microsoft.Update.Session",$Computer)) }
				$UpdateSearcher = $UpdateSession.CreateUpdateSearcher()
				$SearchResult = $UpdateSearcher.Search("IsAssigned=1 and IsHidden=0 and IsInstalled=0")
				$Critical = $SearchResult.updates | where { $_.MsrcSeverity -eq "Critical" }
				$important = $SearchResult.updates | where { $_.MsrcSeverity -eq "Important" }
				$other = $SearchResult.updates | where { $_.MsrcSeverity -eq $null }
				# Get windows updates counters
				$totalUpdates = $($SearchResult.updates.count)
				$totalCriticalUp = $($Critical.count)
				$totalImportantUp = $($Important.count)

				if($totalUpdates -gt 0)
				{
					$updatesToInstall = $true
				}
				else { $updatesToInstall = $false }
			}
			else
			{
				# if cannot connected to the server the updates are listed as not defined
				$totalUpdates = "nd"
				$totalCriticalUp = "nd"
				$totalImportantUp = "nd"
			}
		}
		catch
        {
			# if an error occurs the updates are listed as not defined
        	Write-Warning "$Computer`: $_"
         	$totalUpdates = "nd"
			$totalCriticalUp = "nd"
			$totalImportantUp = "nd"
			$updatesToInstall = $false
        }

        # Querying WMI for build version
        $WMI_OS = Get-WmiObject -Class Win32_OperatingSystem -Property BuildNumber, CSName -ComputerName $Computer -Authentication PacketPrivacy -Impersonation Impersonate

        # Making registry connection to the local/remote computer
        $RegCon = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]"LocalMachine",$Computer)

        # If Vista/2008 & Above query the CBS Reg Key
        if ($WMI_OS.BuildNumber -ge 6001)
        {
            $RegSubKeysCBS = $RegCon.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\").GetSubKeyNames()
            $CBSRebootPend = $RegSubKeysCBS -contains "RebootPending"
        }
		else{
			$CBSRebootPend = $false
		}

        # Query WUAU from the registry
        $RegWUAU = $RegCon.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\")
        $RegSubKeysWUAU = $RegWUAU.GetSubKeyNames()
        $WUAURebootReq = $RegSubKeysWUAU -contains "RebootRequired"

		if($CBSRebootPend –OR $WUAURebootReq)
		{
			$machineNeedsRestart = $true
		}
		else
		{
			$machineNeedsRestart = $false
		}

        # Closing registry connection
        $RegCon.Close()

		if($machineNeedsRestart -or $updatesToInstall -or ($WUStartMode -eq "Manual") -or ($totalUpdates -eq "nd"))
		{
			New-Object PSObject -Property @{
	           	Computer = $WMI_OS.CSName
                WindowsUpdateStatus = $WUStartMode + "/" + $WUState + "/" + $WUStatus
                UpdatesToInstall = $updatesToInstall
                TotalOfUpdates = $totalUpdates
                TotalOfCriticalUpdates = $totalCriticalUp
				TotalOfImportantUpdates = $totalImportantUp
                RebootPending = $machineNeedsRestart
        	}
		}
  	}
	catch
 	{
    	Write-Warning "$Computer`: $_"
  	}
}

Report sample:

Windows-Updates-and-Pending-Restarts-Report

Note: This type of script must be viewed as a complement to the tools mentioned above or used in the absence of them.

You have also to understand that I’m not PowerShell expert but I like to try things and play a little with PowerShell, so for me this script serves my purposes and has given me the chance to learn a little more. However you should also reuse other resources available in the community and use modules like Get-PendingReboot – Query Computer(s) For Pending Reboot State from Brian Wilhite

The script can be found and download on Microsoft TechNet Gallery:
Monitoring Windows Updates and Pending Restarts on the servers using PowerShell (13.1 KB)
Microsoft TechNet Gallery

In my case this error occurred when I was recovering an old BizTalk Server 2004 development environment:

The master secret has not been backed up. If you lose the master secret all the information stored in the SSO system will be lost permanently and your systems may fail to work correctly. Please use the SSO admin tools to back up your master secret.

Event-ID-10589-the-master-secret-has-not-been-backed-up

And this is actually a well know error and that can occurs is all the versions of BizTalk Server and not only in 2004 version and also very easy to solved.

CAUSE

The reason for this error is that the master secret has not yet been backed up. And you need to be very careful because if you lose the master secret all the information stored in the SSO system will be lost permanently and your systems may fail to work correctly.

SOLUTION

As I mentioned earlier, this error is extremely easy to solve and for this we only need to:

  • On the “Start” menu, click “Run” and type “cmd” to open the Command Prompt.
  • At the Command Prompt window, go to the Enterprise Single Sign-On installation directory.
    • The default installation directory is “C:\Program Files\Common Files\Enterprise Single Sign-On”
  • And type the following command to backup your master secret key:
    • ssoconfig -backupsecret <full path to the backup file>
  • This command will ask you to provide a password and a reminder as you can see in the picture bellow:

ssoconfig-backupsecret-command

After that you master secret will be backed up and the error will be solved.

the-master-secrets-were-successfully-backed-up

Other references:

First of all let me apologies for my long absence, almost passed a month since I wrote the last time on my blog and for me is a long time but I’m back… and I assure you that I haven’t been standing doing nothing, on the contrary, I’m working in several white papers, reviewing others, speaking in events, a lot of work and so on… so I still will publish a lot content this year.

Today after installing .NET Framework 4.0 in my BizTalk Server 2006 Lab environment and of course restart the machine, the Enterprise Single Sign-On Service stopped working.

The first error that I found was:

“Could not create SSOSQL. To fix the problem, reinstall SSO or try ‘regasm SSOSQL.dll’ from a Visual Studio command prompt.
Error Code: 0x80131700”

This was an error that I already blogged in the past and you can find more information here. But basically you need to fix the Enterprise Single Sign-On by running the following command: regasm SSOSQL.dll.

After solving this problem I tried to start it manually the SSO Service but surprisingly, I got two new errors in the event viewer:

“Could not create SSOCSTX. To fix the problem, reinstall SSO or install SSOCSTX.dll into a COM+ library application.
Additional Data: 93
Error Code: 0x8004E00F, COM+ was unable to talk to the Microsoft Distributed Transaction Coordinator”

Could-not-create-SSOCSTX-error

Followed by:

“The SSO service failed to start.
Error Code: 0x8004E00F, COM+ was unable to talk to the Microsoft Distributed Transaction Coordinator”

The-SSO-service-failed-to-start-error

At this point for me it was clear I have issues with MSDTC.

After searching a little I found the first possible solution that basically told me to u reinstall the Microsoft Distributed Transaction Coordinator (MSDTC) to resolve the issue, of course this was a solution that I was trying to avoid.

SOLUTION

The first thing you must do is to check if the MSDTC is running and make sure the MSDTC security settings are configured correctly:

  • Network DTC Access – Checked
  • Client and Administration
    • Allow Remote Clients – Checked
  • Transaction Manager Communication
    • Allow Inbound – checked
    • Allow Outbound – Checked
    • No authentication required – checked

In my case everything was properly configured so next step:

  • Why not try to restart the Microsoft Distributed Transaction Coordinator (MSDTC) service?

Since that is the cause of the current problems… that seams a good idea, better this that reinstall the MSDTC J

Wow! Bingo! Found the solution to all my problems! After restarted successfully the MSDTS Service I was able to start the Enterprise Single Sign-On Service and of course the BizTalk Services with success.

I finally fulfill the promise to upgrade BizTalk Mapper Extensions UtilityPack for BizTalk Server 2006/2009 with all FunctoIds that are currently available for the 2010 and 2013 versions of this project… and if memory serves me correctly, the last version was published on Nov 18, 2010 with only 6 FunctoIds!

This means there’s plenty of new features for BizTalk Server 2006/2009 in this project… a total of 17 new FunctoIds.

Project Description

BizTalk Mapper Extensions UtilityPack is a set of libraries with several useful functoids to include and use it in a map, which will provide an extension of BizTalk Mapper capabilities. This is the list of previous functoids available:

What’s new in this version for BizTalk Server 2006/2009?

Conversion Functoids

  • Convert datetime format Functoid: This functoid allows you to convert datetime format.

Dynamic Generators Functoids

  • Tiny Id Generator Functoid: This functoid allows you to generate a new Tiny Id.

Configuration Functoids

  • BTSNTSvc Config Get Functoid: This functoid allows you to get configuration parameters from BTSNTsvc.exe.config. If there is no section specified, the functoid reads from the AppSettings.
  • System Environment Variable Get Functoid: This functoid allows you to get configuration parameters from machine System Environment Variable.
  • Custom Config Get Functoid: This functoid allows you to get configuration parameters from a custom configuration file.
  • Windows Registry Config Get Functoid: This functoid allows you to get configuration parameters from Windows Registry.
  • SSO Config Get Functoid: This functoid allows you to get configuration parameters from SSO Database.
  • Rule Engine Config Get Functoid: This functoid allows you to obtain a definition value from a Vocabulary in the Business Rules Engine.

CRM Functoids

  • CRM Lookup Functoid: This functoid allows you to retreive a value from CRM lookup field.

String Functoids

  • String Constant functoid: This functoid allows you to set constant values (strings) inside de maps.
  • String ToTitleCase functoid: This functoid allows you to Converts the specified string to title case (except for words that are entirely in uppercase, which are considered to be acronyms).
  • String Advance Compare Functoid: This functoid allows you to compare two specified String objects, ignoring or honoring their case, and returns an boolean that indicates if they are equal or not.
  • String Replace Functoid: This functoid returns a new string in which all occurrences of a specified string (second parameter) found in the first string are replaced with another specified string (third parameter).
  • String Normalize Functoid: This functoid allows you to normalize the text. It will remove two or more consecutive spaces and replace them with a single space, remove two or more consecutive newlines and replace them with a single newline and “condense” multiple tabs into one.
  • String PadLeft Functoid: This functoid allows you to set a new string that right-aligns the characters in this instance by padding them on the left with a specified Unicode character, for a specified total length.
  • String PadRight Functoid: This functoid allows you to set a new string that left-aligns the characters in this string by padding them on the right with a specified Unicode character, for a specified total length.

Custom Advanced Functoids

  • Default Value Mapping functoid: The Default Value Mapping have a simillar but different behaviour. You can use the Default Value Mapping functoid to return a value from one of two input parameters. If the value of the first input parameter is Null or Empty, then the value of the second input parameter is returned, otherwise the first input is returned.

Also this means that now all versions of this project are equal!

You can found and download Source Code, Application Binaries and Documentation in CodePlex BizTalk Mapper Extensions UtilityPack home page:

BizTalk Mapper Extensions UtilityPack
CodePlex

 

or from MSDN Code Gallery:

BizTalk Mapper Extensions UtilityPack for BizTalk Server 2006/2009 (601.5 KB)
Microsoft | MSDN Code Gallery

Personally I like to create all my BizTalk Server installation and configuration process manually at least one time or maybe from time to time, but when we are dealing with several environments and even worse each environment with several BizTalk Servers… this can be very annoying and time consuming. In this case automation is the key!

One of the task that we need to do in all our new BizTalk environment over and over again is creating and configuring the Host, Host Instances and of course the adapter handlers.

What’s is Host, Host Instances and Adapter Handlers?

The BizTalk Host is a logical process and security boundary within BizTalk Server that represents a logical set of zero or more run-time processes in which you can deploy BizTalk Server services and artifacts (such as adapter handlers, receive locations, and orchestrations). Each host has a security group assigned to it and may contain multiple host instances, each on an individual machine, that perform the work of the host.

In turn, a host instance is the physical instance of a host on a computer running BizTalk Server. Each host instance belongs to exactly one host, and the service account of the host instance belongs to the security group of the host. The security group may be used to grant permissions to physical resources such as databases for use by any host instances in the host.

An adapter handler is an instance of a BizTalk host in which the adapter code runs. When you specify a send or receive handler for an adapter you are specifying which host instance the adapter code will run in the context of. An adapter handler is responsible for executing the adapter and contains properties for a specific instance of an adapter. A default BizTalk Server configuration will create adapter handlers for all of the installed adapters, but you may want to create additional adapter handlers for purposes of load balancing or to provide process isolation for a particular adapter handler.

Best practices to Configuring Hosts and Host Instances

As the official documentation specify, in addition to the high availability aspects of the host instance configuration, you should separate sending, receiving, processing, and tracking functionality into multiple hosts. This provides flexibility when configuring the workload in your BizTalk group and is the primary means of distributing processing across a BizTalk group.

This also allows you to stop one host without affecting other hosts. For example, you may want to stop sending messages to let them queue up in the MessageBox database, while still allowing the inbound receiving of messages to occur.

Separating host instances by functionality also provides some of the following benefits:

  • Each host instance has its own set of resources such as memory, handles, and threads in the .NET thread pool.
  • Multiple BizTalk Hosts will also reduce contention on the MessageBox database host queue tables since each host is assigned its own work queue tables in the MessageBox database.
  • Throttling is implemented in BizTalk Server at the host level. This allows you to set different throttling characteristics for each host.
  • Security is implemented at the host level; each host runs under a discrete Windows identity.

However this also may bring some potential drawbacks if too many host instances are created because each host instance is a Windows service (BTSNTSvc.exe or BTSNTSvc64.exe), which generates additional load against the MessageBox database and consumes computer resources (such as CPU, memory, threads), so you need to be careful.

Normally we read that we need to create at least 4 host instances: sending, receiving, processing, and tracking, but that’s not absolutely true because, at least with the newer environments, we typically use 64-bits versions and in this case we also need to create at least one Host Instance that will run on 32-bits because FTP adapter, SQL adapter, POP3 adapter and MIME Decoder on 64-bit host instances is not supported by the product (http://technet.microsoft.com/en-us/library/aa560166.aspx)

We can define that one of the best practices for hosts and host instances is the following:

  • BizTalkServerTrackingHost: A BizTalk Host that hosts tracking is responsible for moving the DTA and BAM tracking data from the MessageBox database to the BizTalk Tracking (DTA) and BAM Primary Import databases. This movement of tracking data has an impact on the performance of other BizTalk artifacts that are running in the same host that is hosting tracking. Thus, you should use a dedicated host that does nothing but host tracking.
    • Only the optionAllow Host Tracking” must be selected because we only will use this host for tracking.
  • BizTalkServerReceiveHost: All options (Allow Host Tracking”, “32-bits only” or “Make this default host in the group”) should be unselected. This host will be responsible for processing messages after they are picked up in a receive location. When a host contains a receiving item, such as a receive location (with a pipeline), the message decoding and decrypting occurs in a pipeline within this host.
    • All receive handlers, except the isolated ones like SOAP, HTTP, WCF-BasicHttp, WCF-WsHttp or WCF-CustomIsolated and 32 bit adapters (FTP,SQL and POP3) will be configured for this host. This will mean also that all receive locations will run in this host instance.
  • BizTalkServerReceive32Host: has the same goal as the previous however this must have the “32-bits only” option select so that we can run the 23-bits adapters.
    • The receive handlers for the FTP, SQL and POP3 adapters will be configured for this host.
  • BizTalkServerSendHost: All options (Allow Host Tracking”, “32-bits only” or “Make this default host in the group”) should be unselected. This host will be responsible for processing messages before they are sent out to the send port. When a host contains a sending item, such as a send port, the message signing and encryption occurs in a pipeline within this host.
    • All send handlers, except 32 bit adapters like native SQL and FTP adapter, will be configured for this host. This will mean also that all send ports will run in this host instance.
  • BizTalkServerSend32Host: has the same goal as the previous however this must have the “32-bits only” option select so that we can run the 32-bits adapters.
    • The Send handlers for the FTP and SQL adapters will be configured for this host.
  • BizTalkServerApplication: Only the option32-bits only” should be select in this host. This host will be responsible for process messages based on the instructions in orchestrations that need to run in 32-bits.
  • BizTalkServerApplication64Host: Only the optionMake this default host in the group” should be select in this host. This host will be responsible for process messages based on the instructions in all or most common orchestrations.

Note: You can create other Application Host if you want to separate process base in some application logic.

How can I automate this task?

Windows PowerShell is a Windows command-line shell designed especially for system administrators and can be used by BizTalk administrators to help them in automating tasks.

This is a simple script to configure the Host, Host Instance and Adapter Handlers described earlier in this post:
Function that will create a new BizTalk Host

function CreateBizTalkHost([string]$hostName, [int]$hostType, [string]$ntGroupName, [bool]$authTrusted, [bool]$isTrackingHost, [bool]$is32BitOnly)
{
    try
    {
        [System.Management.ManagementObject]$objHostSetting = ([WmiClass]"root/MicrosoftBizTalkServer:MSBTS_HostSetting").CreateInstance()

        $objHostSetting["Name"] = $hostName
        $objHostSetting["HostType"] = $hostType
        $objHostSetting["NTGroupName"] = $ntGroupName
        $objHostSetting["AuthTrusted"] = $authTrusted
        $objHostSetting["IsHost32BitOnly"] = $is32BitOnly
        $objHostSetting["HostTracking"] = $isTrackingHost

        $putOptions = new-Object System.Management.PutOptions
        $putOptions.Type = [System.Management.PutType]::CreateOnly;

        [Type[]] $targetTypes = New-Object System.Type[] 1
        $targetTypes[0] = $putOptions.GetType()

        $sysMgmtAssemblyName = "System.Management"
        $sysMgmtAssembly = [System.Reflection.Assembly]::LoadWithPartialName($sysMgmtAssemblyName)
        $objHostSettingType = $sysMgmtAssembly.GetType("System.Management.ManagementObject")

        [Reflection.MethodInfo] $methodInfo = $objHostSettingType.GetMethod("Put", $targetTypes)
        $methodInfo.Invoke($objHostSetting, $putOptions)

		Write-Host "Host $hostName was successfully created" -Fore DarkGreen
    }
    catch [System.Management.Automation.RuntimeException]
    {
		if ($_.Exception.Message.Contains("Another BizTalk Host with the same name already exists in the BizTalk group.") -eq $true)
        {
			Write-Host "$hostName can't be created because another BizTalk Host with the same name already exists in the BizTalk group." -Fore DarkRed
        }
		else{
        	write-Error "$hostName host could not be created: $_.Exception.ToString()"
		}
    }
}

Function that will update an existent BizTalk Host

function UpdateBizTalkHost([string]$hostName, [int]$hostType, [string]$ntGroupName, [bool]$authTrusted, [bool]$isTrackingHost, [bool]$is32BitOnly, [bool]$isDefaultHost)
{
    try
    {
        [System.Management.ManagementObject]$objHostSetting = ([WmiClass]"root/MicrosoftBizTalkServer:MSBTS_HostSetting").CreateInstance()

        $objHostSetting["Name"] = $hostName
        $objHostSetting["HostType"] = $hostType
        $objHostSetting["NTGroupName"] = $ntGroupName
        $objHostSetting["AuthTrusted"] = $authTrusted
        $objHostSetting["IsHost32BitOnly"] = $is32BitOnly
        $objHostSetting["HostTracking"] = $isTrackingHost
		$objHostSetting["IsDefault"] = $isDefaultHost

        $putOptions = new-Object System.Management.PutOptions
        $putOptions.Type = [System.Management.PutType]::UpdateOnly; # This tells WMI it's an update.

        [Type[]] $targetTypes = New-Object System.Type[] 1
        $targetTypes[0] = $putOptions.GetType()

        $sysMgmtAssemblyName = "System.Management"
        $sysMgmtAssembly = [System.Reflection.Assembly]::LoadWithPartialName($sysMgmtAssemblyName)
        $objHostSettingType = $sysMgmtAssembly.GetType("System.Management.ManagementObject")

        [Reflection.MethodInfo] $methodInfo = $objHostSettingType.GetMethod("Put", $targetTypes)
        $methodInfo.Invoke($objHostSetting, $putOptions)

		Write-Host "Host $hostName was successfully updated" -Fore DarkGreen
    }
    catch [System.Management.Automation.RuntimeException]
    {
        write-Error "$hostName host could not be updated: $_.Exception.ToString()"
    }
}

Function that will create a new BizTalk Host Instance

function CreateBizTalkHostInstance([string]$hostName, [string]$serverName, [string]$username, [string]$password)
{
    try
    {
        [System.Management.ManagementObject]$objServerHost = ([WmiClass]"root/MicrosoftBizTalkServer:MSBTS_ServerHost").CreateInstance()

        $objServerHost["HostName"] = $hostName
        $objServerHost["ServerName"] = $serverName
        $objServerHost.Map()

        [System.Management.ManagementObject]$objHostInstance = ([WmiClass]"root/MicrosoftBizTalkServer:MSBTS_HostInstance").CreateInstance()

        $name = "Microsoft BizTalk Server " + $hostName + " " + $serverName
        $objHostInstance["Name"] = $name
        $objHostInstance.Install($username, $password, $true)

		Write-Host "HostInstance $hostName was mapped and installed successfully. Mapping created between Host: $hostName and Server: $Server);" -Fore DarkGreen
    }
    catch [System.Management.Automation.RuntimeException]
    {
		if ($_.Exception.Message.Contains("Another object with the same key properties already exists.") -eq $true)
        {
			Write-Host "$hostName host instance can't be created because another object with the same key properties already exists." -Fore DarkRed
        }
		else{
        	write-Error "$hostName host instance on server $Server could not be created: $_.Exception.ToString()"
		}
    }
}

Function that will delete an existent host handlers in the adapters

function DeleteBizTalkAdapterHandler([string]$adapterName, [string]$direction, [string]$hostName)
{
	try
    {
		if($direction -eq 'Receive')
		{
			[System.Management.ManagementObject]$objHandler = get-wmiobject 'MSBTS_ReceiveHandler' -namespace 'root\MicrosoftBizTalkServer' -filter "HostName='$hostName' AND AdapterName='$adapterName'"
	        $objHandler.Delete()
		}
		else
		{
			[System.Management.ManagementObject]$objHandler = get-wmiobject 'MSBTS_SendHandler2' -namespace 'root\MicrosoftBizTalkServer' -filter "HostName='$hostName' AND AdapterName='$adapterName'"
	        $objHandler.Delete()
		}

		Write-Host "$direction handler for $adapterName / $hostName was successfully deleted" -Fore DarkGreen
    }
    catch [System.Management.Automation.RuntimeException]
    {
        if ($_.Exception.Message -eq "You cannot call a method on a null-valued expression.")
        {
			Write-Host "$adapterName $direction Handler for $hostName does not exist" -Fore DarkRed
        }
        elseif ($_.Exception.Message.IndexOf("Cannot delete a receive handler that is used by") -ne -1)
        {
			Write-Host "$adapterName $direction Handler for $hostName is in use and can't be deleted." -Fore DarkRed
        }
		elseif ($_.Exception.Message.IndexOf("Cannot delete a send handler that is used by") -ne -1)
        {
			Write-Host "$adapterName $direction Handler for $hostName is in use and can't be deleted." -Fore DarkRed
        }
		elseif ($_.Exception.Message.IndexOf("Cannot delete this object since at least one receive location is associated with it") -ne -1)
        {
			Write-Host "$adapterName $direction Handler for $hostName is in use by at least one receive location and can't be deleted." -Fore DarkRed
        }
        else
        {
            write-Error "$adapterName $direction Handler for $hostName could not be deleted: $_.Exception.ToString()"
        }
    }
}

Function that will create a handler for a specific adapter on the host

function CreateBizTalkAdapterHandler([string]$adapterName, [string]$direction, [string]$hostName, [string]$originalDefaulHostName, [boolean]$isDefaultHandler, [boolean]$removeOriginalHostInstance)
{
	if($direction -eq 'Receive')
	{
		[System.Management.ManagementObject]$objAdapterHandler = ([WmiClass]"root/MicrosoftBizTalkServer:MSBTS_ReceiveHandler").CreateInstance()
		$objAdapterHandler["AdapterName"] = $adapterName
	    $objAdapterHandler["HostName"] = $hostName
	}
	else
	{
		[System.Management.ManagementObject]$objAdapterHandler = ([WmiClass]"root/MicrosoftBizTalkServer:MSBTS_SendHandler2").CreateInstance()
		$objAdapterHandler["AdapterName"] = $adapterName
	    $objAdapterHandler["HostName"] = $hostName
	    $objAdapterHandler["IsDefault"] = $isDefaultHandler
	}

    try
    {
        $putOptions = new-Object System.Management.PutOptions
        $putOptions.Type = [System.Management.PutType]::CreateOnly;

        [Type[]] $targetTypes = New-Object System.Type[] 1
        $targetTypes[0] = $putOptions.GetType()

        $sysMgmtAssemblyName = "System.Management"
        $sysMgmtAssembly = [System.Reflection.Assembly]::LoadWithPartialName($sysMgmtAssemblyName)
        $objAdapterHandlerType = $sysMgmtAssembly.GetType("System.Management.ManagementObject")

        [Reflection.MethodInfo] $methodInfo = $objAdapterHandlerType.GetMethod("Put", $targetTypes)
        $methodInfo.Invoke($objAdapterHandler, $putOptions)

        Write-Host "$adapterName $direction Handler for $hostName was successfully created" -Fore DarkGreen
    }
    catch [System.Management.Automation.RuntimeException]
    {
		if ($_.Exception.Message.Contains("The specified BizTalk Host is already a receive handler for this adapter.") -eq $true)
        {
			Write-Host "$hostName is already a $direction Handler for $adapterName adapter." -Fore DarkRed
        }
		elseif($_.Exception.Message.Contains("The specified BizTalk Host is already a send handler for this adapter.") -eq $true)
        {
			Write-Host "$hostName is already a $direction Handler for $adapterName adapter." -Fore DarkRed
        }
		else {
        	write-Error "$adapterName $direction Handler for $hostName could not be created: $_.Exception.ToString()"
		}
    }

	if($removeOriginalHostInstance)
	{
		DeleteBizTalkAdapterHandler $adapterName $direction $originalDefaulHostName
	}
}

Function that will have the logic you want to implement to create the default hosts and host instances and add configure the host instances to the various handlers

function ConfiguringBizTalkServerHostAndHostInstances
{
	# Separate sending, receiving, processing, and tracking functionality into multiple hosts.
	# This provides flexibility when configuring the workload and enables you to stop one host without affecting other hosts.
	# you can use a common well use convention to define the name of the host:
	#  - <Job>_<bit support>_<seq>_<adapter/functionality>_<throughput>_<priority>_<clustered>
	# Sample 'Rcv_x32_1_FTP_L_Critical_Clustered'
	# But I will use a more simple convencion
	# Defining the names of the hosts
	[string]$receiveHostName = 'BizTalkServerReceiveHost'
	[string]$sendHostName = 'BizTalkServerSendHost'
	[string]$processingHostName = 'BizTalkServerApplication64Host' # use this to create another processing host
	[string]$trackingHostName = 'BizTalkServerTrackingHost'
	# Note: why we need to create 32bits hosts? FTP, POP3 and SQL doesn't support 64bits
	[string]$receive32HostName = 'BizTalkServerReceive32Host'
	[string]$send32HostName = 'BizTalkServerSend32Host'

	# 'BizTalkServerApplication' is the default host instance created when you install the biztalk on your box.
	# This application will be running on "32-bit only".
	[string]$defaultHostName = 'BizTalkServerApplication'

 	##############################
	# Creating hosts for receiving
	# HostType: Invalid: 0, In-process:	1, Isolated: 2
	CreateBizTalkHost $receiveHostName 1 $ntHostGroupName $false $false $false
	CreateBizTalkHost $receive32HostName 1 $ntHostGroupName $false $false $true

	# Create a host instances for receiving associated with the previous hosts created
	CreateBizTalkHostInstance $receiveHostName $bizTalkServerName $hostCredentials.UserName $hostCredentialsPassword
	CreateBizTalkHostInstance $receive32HostName $bizTalkServerName $hostCredentials.UserName $hostCredentialsPassword

	# Set adapters that should be handled by receiving host instance
	CreateBizTalkAdapterHandler 'FILE' 'Receive' $receiveHostName $defaultHostName $false $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'MQSeries' 'Receive' $receiveHostName $defaultHostName $false $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'MSMQ' 'Receive' $receiveHostName $defaultHostName $false $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'WCF-Custom' 'Receive' $receiveHostName $defaultHostName $false $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'WCF-NetMsmq' 'Receive' $receiveHostName $defaultHostName $false $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'WCF-NetNamedPipe' 'Receive' $receiveHostName $defaultHostName $false $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'WCF-NetTcp' 'Receive' $receiveHostName $defaultHostName $false $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'Windows SharePoint Services' 'Receive' $receiveHostName $defaultHostName $false $removeOriginalAdapterHandler
	#32 bits adapters
	CreateBizTalkAdapterHandler 'FTP' 'Receive' $receive32HostName $defaultHostName $false $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'POP3' 'Receive' $receive32HostName $defaultHostName $false $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'SQL' 'Receive' $receive32HostName $defaultHostName $false $removeOriginalAdapterHandler

 	##############################
	# Creating hosts for sending
	# HostType: Invalid: 0, In-process:	1, Isolated: 2
	CreateBizTalkHost $sendHostName 1 $ntHostGroupName $false $false $false
	CreateBizTalkHost $send32HostName 1 $ntHostGroupName $false $false $true

	# Create a host instances for sending associated with the previous hosts created
	CreateBizTalkHostInstance $sendHostName $bizTalkServerName $hostCredentials.UserName $hostCredentialsPassword
	CreateBizTalkHostInstance $send32HostName $bizTalkServerName $hostCredentials.UserName $hostCredentialsPassword

	# Set adapters that should be handled by sending host instance
	CreateBizTalkAdapterHandler 'FILE' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'HTTP' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'MQSeries' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'MSMQ' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'SOAP' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'SMTP' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'WCF-BasicHttp' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'WCF-Custom' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'WCF-NetMsmq' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'WCF-NetNamedPipe' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'WCF-NetTcp' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'WCF-WSHttp' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'Windows SharePoint Services' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	#32 bits adapters
	CreateBizTalkAdapterHandler 'FTP' 'Send' $send32HostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'SQL' 'Send' $send32HostName $defaultHostName $true $removeOriginalAdapterHandler

	# Create a host for tracking
	CreateBizTalkHost $trackingHostName 1 $ntHostGroupName $false $true $false

	# Create a host for orchestrations
	CreateBizTalkHost $processingHostName 1 $ntHostGroupName $false $false $false

	# Create a host instance for orchestrations
	CreateBizTalkHostInstance $processingHostName $bizTalkServerName $hostCredentials.UserName $hostCredentialsPassword

	# Create a host instance for tracking
	CreateBizTalkHostInstance $trackingHostName $bizTalkServerName $hostCredentials.UserName $hostCredentialsPassword

	# Remove "Allow Host Tracking" options from BizTalkServerApplication Host
	UpdateBizTalkHost $defaultHostName 1 $ntHostGroupName $false $false $true $true

	# Updating the processinh host to be the default host
	UpdateBizTalkHost $processingHostName 1 $ntHostGroupName $false $false $false $true
}

And in the last the main script

Write-Host "Starting configure the BizTalk Server environment..." -Fore DarkGreen

# General variables
# Defining the BizTalk Server Name, this line will read the Server name on which the script is running
$bizTalkServerName = $(Get-WmiObject Win32_Computersystem).name

# STEP 1
# The Windows group is used to control access of a specif host and associated host instances to databases and other
# resources. Each instance of this host must run under a user account that is a member of this group.
# Note that you can change the Windows group only if no instances of this host exist.
# Defining the name of the group the BizTalk hosts should run under
[string]$ntHostGroupName = Read-Host -Prompt "Please enter windows group to control access to Hosts and ssociated Host Instances"

# STEP 2
# This account must have SQL Server permissions. The recommended way to grant these permissions is to add this account
# to the BizTalk Server Host Windows group.
# BizTalk Server will add this account to the "Log on as a service" security policy.
# For domain accounts, use "domain\user" format
# Defining the credentials in witch the host instance should run under.
try
{
	$domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
	$domainName = $domain.name
}
catch
{
	$domainName = $(Get-WmiObject Win32_Computersystem).name
}
$hostCredentials = $Host.ui.PromptForCredential("Logon Credentials","This account must have SQL Server permissions. The recommended way to grant these permissions is to add this account to the BizTalk Server Host Windows group.

BizTalk Server will add this account to the 'Log on as a service' security policy", $domainName + "\", "");
[String]$hostCredentialsPassword = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($hostCredentials.Password));

# STEP 3
# Defining the option if you want to automatically try to remove the BizTalkServerApplication Host Instance from
# the Adapters handlers
$windowsShell = new-object -comobject wscript.shell
$questionResult = $windowsShell.popup("Do you want to try to remove the BizTalkServerApplication Host Instance from the Adapters handlers?

Note: The script cannot remove the default host instances if there are any receiveports, sendports or orchestrations configured.",
						  0,"BizTalk Applications, Receive and Send Ports",4)

If ($questionResult -eq 6) {
	$removeOriginalAdapterHandler = $true
}
else {
	$removeOriginalAdapterHandler = $false
}

# STEP 4
# Create default hosts, host instances and handlers
Write-Host "Creating hosts and host instances..." -Fore DarkGreen
ConfiguringBizTalkServerHostAndHostInstances

# STEP 5
# This configurations changes requires host instances restart for the changes to take effect.
# Check if you want to restart the Host Instances
Write-Host "Host and Host Instance configuration is almost completed..." -Fore DarkGreen
$questionResult = $windowsShell.popup("This configurations changes requires host instances restart for the changes to take effect.

Do you want to restart the Host Instances now?", 0,"Please restart Host Instances",4)
If ($questionResult -eq 6) {
	get-service BTS* | foreach-object -process {restart-service $_.Name}
	Write-Host "Restart Host Instance completed..." -Fore DarkGreen
}

# STEP 6
# Check if you want to properly configure BizTalk Services and Enterprise Single Sign-On Service 'Startup type' property
# to Automatic (Delayed Start)
$questionResult = $windowsShell.popup("By default, the 'Startup type' propriety of BizTalk Services and Enterprise Single Sign-On Service are set as 'Automatic', however BizTalk Server services may not start automatically after a system restart, to avoid this behavior you must config the 'Startup type' to 'Automatic (Delayed Start)'.

Do you want to configure BizTalk Services to 'Automatic (Delayed Start)'?", 0,"Configure BizTalk Services to Automatic (Delayed Start)",4)
If ($questionResult -eq 6) {
	#=== Name of the Enterprise Single Sign-On Service. ===#
	$entSSOServiceName = 'ENTSSO'

	#=== Change the startup type for BizTalk services to Automatic (Delayed Start) ===#
	get-service BTSSvc* | foreach-object -process { SC.EXE config $_.Name start= delayed-auto}

	#=== Change the startup type for Enterprise Single Sign-On Service to Automatic (Delayed Start) ===#
	SC.EXE config $entSSOServiceName start= delayed-auto

	Write-Host "BizTalk Services and SSO configured successfully..." -Fore DarkGreen
}

Write-Host "Your BizTalk Server environment is now properly configured" -Fore DarkGreen

The script can be found and download on Microsoft TechNet Gallery:
PowerShell to Configure BizTalk Server Host and Host Instances (7.4 KB)
Microsoft TechNet Gallery

For the last weeks I have been preparing my demos for BizTalk Innovation day in Norway and Italy that will occur during September and October were I will talk about BizTalk Mapping Patterns and Best Practices. Functoids will definitely be one of the topics that I will discuss and the reason I published a new release of this project was the need of this new functoid for one of my labs.

Sometimes the functoids I create are inspired in real scenarios for the need of my clients, others requested by community members and sometimes for playing like this one… but always if I think for some reason that they will be useful in real scenarios. But regardless of the reasons, I am very glad that this project is constantly evolving and have already 23 functoids!

Project Description

BizTalk Mapper Extensions UtilityPack is a set of libraries with several useful functoids to include and use it in a map, which will provide an extension of BizTalk Mapper capabilities. This is the list of previous functoids available:

What’s new in this version?

In the BizTalk Business Rules Engine you can define a vocabulary which is essentially parameters which can be used within the execution of a rules policy. These vocabularies can be accessed from C# code so the idea here is that you could define constants in a vocabulary which you could deploy to the BRE which you would then access from a helper class to get your configuration data.

Rule Engine Config Get Functoid

This functoid allows you to obtain a definition value from a Vocabulary in the Business Rules Engine.

Parameters

The functoid takes one mandatory input parameters:

  1. String that represents the definition name (e.g. Value1).
  2. String that represents the vocabulary name (i.e. Config).

The output of the functoid is a string with the value of the definition name from a specify vocabulary on the Business Rule Engine: “Set dynamic constant using Business Rule Engine”

Rule-Engine-Config-Get-functoid

You can find the advantages and disadvantages for storing configurations in a Vocabulary in the Rules Engine in this post from Michael Stephenson: Where do I store my custom configuration for a BizTalk solution
You can found and download Source Code, Application Binaries and Documentation in CodePlex BizTalk Mapper Extensions UtilityPack home page:

BizTalk Mapper Extensions UtilityPack
CodePlex

 

or from MSDN Code Gallery:

BizTalk Mapper Extensions UtilityPack for BizTalk Server 2013 (538.1 KB)
Microsoft | MSDN Code Gallery

 

BizTalk Mapper Extensions UtilityPack for BizTalk Server 2010 (747.7 KB)
Microsoft | MSDN Code Gallery

First of all I have to say thanks and welcome to the recent contributor Michael Stephenson to this project.

I’m sure he probably don’t need any introductions, never the less, Michael Stephenson is a UK based integration specialist who has worked with many consultancies and customers delivering integration solutions based on Microsoft technologies such as BizTalk and Windows Azure. He is heavily involved in community activities such as the UK Connected Systems User Group and speaking at events across Europe. Michael has also been a Microsoft Integration MVP for the past 5 years.

Having said that and thanks to Michael contributions, there’s a new release available of “Collection of Visio 2013 Stencil for BizTalk Server” with 3 new modern flat Visio 2013 shapes making a total of 76 modern flat shapes that you can use and resize without losing quality:

3-new-modern-flat-Visio-2013-shapes

That you can download it for free and start using it to help you representing BizTalk Server physical architectures, Integration architectures (Cloud or Hybrid scenarios) or solutions diagrams in Visio 2013:

  • BizTalk Servers shapes
    • BizTalk, SQL, BAM, IIS and so on…
  • Common BizTalk artifacts:
    • Orchestrations, Receive and Send Pipelines, Transformations and Filters
  • BizTalk Out-of-box Adapters shapes
    • SMTP, SQL, File, FTP, SFTP, MSMQ, …
  • Business Activity Monitoring, Business Rules Engine, BizTalk Console Administration and BizTalk360
  • Windows Azure BizTalk Services and Cloud shapes
  • Common Integration Servers shapes
    • SMTP, Active Directory, Web, Mainframe, …
  • Certificates, RFID, Gateway, Secure Message and many more…

BizTalk-Server-Stencils-For-Visio-2013

You can download Visio 2013 Stencil for BizTalk Server (or Visio icons for BizTalk Server) from:

Collection of Visio 2013 Stencil for BizTalk Server (1.2 MB)
Microsoft | TechNet Gallery

 

Other Resources: