Article Published on ASPAlliance: Using BTSTask to Create MSI Deployment Packages
I recently wrote an article for ASPAlliance on Using BTSTask to Create MSI Deployment Packages. Check it out!
DBMessageLogger – A Streaming Message Logger Pipeline component
Update (4/7/2008):
Please note that this pipeline component is not a substitute for the Message Tracking feature in BizTalk which can track messages at the port and orchestration level. Message Tracking is a built-in feature within BizTalk and has all of these advantages:
- HAT can be used to find the message
- Very easy to Configure Tracking Using the BizTalk Admin Console.
- You can setup backup and archiving for the messages.
- No custom coding required.
It is important to note however that the Message Tracking feature is a system level tracking which tracks messages at an artifact level (Orchestrations and Ports). If you need message tracking that has more context within a business process then you should consider using BAM with message body tracking. My PC below is an alternative to the BAM solution since I provide hooks for tying the tracked message to other business level tracking data.
Thanks to Michael Stephenson for his valueable feedback regarding this topic.
Original Post (4/6/2008):
If you ever had any requirements to archive or log a BizTalk message then you have probably looked into handling this within a pipeline component (PC). I had a similar requirement but I wanted to be able to log the message into a database table. There is a pretty decent example of a PC that can log messages to file on Gille’s WebLog. The sample code may be a little outdated though.
So I set out to build a PC that can log BizTalk message parts on receive or send sides and also be able to abort gracefully in the event of a failure. Since logging is a non-critical operation, I do not want a failure during this operation to disrupt the entire process. My primary goal for this PC was to read the message data in a streaming fashion and then save it to the database in chunks. This design allows the PC to be scalable when dealing with large messages.
Let’s start by looking at the database tables necessary for storing the messages.
The first table is named IntegrationMessages and it has only one column named PayloadMessageId. This table has one record for every interchange that arrives into BizTalk via receive pipelines or leaves BizTalk via send pipelines.

The second table is named IntegrationMessageParts and it is used to store the actual message parts in binary format. Note that we are storing all message parts and not just the body part of a message.

Now let’s take a look at the design time properties available within this pipeline component.
Design time properties:
Enabled: This property enables or disables the logging capability of this pipeline component. If Enabled is false, then the pipeline component simply passes on the message down the pipeline without any processing.
LogContext: This property specifies whether this pipeline component is being used in a receive pipeline or a send pipeline.
MsgReadChunkSizeInBytes: This property is used to specify the size of the buffer used to temporarily store the message contents while reading from the stream.
ReceiveContextPropName: This property is only applicable when the LogContext is set to Receive. It is used to specify the property name when writing the PayloadMessageId (from the IntegrationMessages table) to the context.
ReceiveContextPropNamespace: This property is only applicable when the LogContext is set to Receive. It is used to specify the property namespace when writing the PayloadMessageId (from the IntegrationMessages table) to the context.
SendContextPropName: This property is only applicable when the LogContext is set to Send. It is used to specify the name of the property that allows
SendContextPropNamespace: This property is only applicable when the LogContext is set to Send.
Download BTSMessageLogger Solution. It includes the pipeline component project, a sample BizTalk project that uses the component and a Windows application to view the logged messages in the DB.
Instructions
1) Extract the contents of the BTSMessageLogger.zip to C:\
2) Deploy the CustomerProcess project from within Visual Studio
3) Run the .\SQL\BTSMessageLogging_CREATE.sql on the local SQL instance to create the logger database
4) Import the bindings from the binding folder
5) Start the application
6) Drop the .\Sample Data\Customer3Rows.txt into C:\BTSMessageLogger\File Drops\In
7) Three (3) xml files should appear in C:\BTSMessageLogger\File Drops\Out
Use the MessageViewer application to view the logged messages
Multi-server BizTalk Configuration under a NT4 Domain
I ran into the error below when configuring BizTalk in a multi-server environment (1 SQL Server + 1 BizTalk Server). It turns out that both servers were members of a NT4 domain. I discovered that BizTalk does not support NT4 domains. As stated in the installation document, only Active Directory (AD) domains are supported.
TITLE: Microsoft BizTalk Server 2006 Configuration Wizard
——————————
CORP\QABTSServerAdmins is not an valid domain group. (ConfigHelper)
——————————
ADDITIONAL INFORMATION:
The specified domain either does not exist or could not be contacted. (ConfigHelper)
The system cannot find the file specified. (Exception from HRESULT: 0×80070002)
Have you ever seen the error below? The error tells you that it cannot find a file but it does not mention the name of the file! In my case, I had a map with a script functoid that referenced an external assembly. It turns out that I copied this map from another project and the assembly reference was no longer valid. I should have encountered build errors but instead I had to deal with this issue at runtime.
Event Type: Error
Event Source: BizTalk Server 2006
Event Category: BizTalk Server 2006
Event ID: 5753
Date: 2/8/2008
Time: 2:24:53 PM
User: N/A
Computer: QSI-BTS06R201
Description:
A message received by adapter “FILE” on receive location “RCV.CUST.DATA.FROM.SYSTEM.A” with URI “C:\BTSMessageLogger\File Drops\In\copy*.txt” is suspended.
Error details: The system cannot find the file specified. (Exception from HRESULT: 0×80070002)
MessageId: {A916E973-85FB-42B0-83CB-84670D0DDAFF}
InstanceID: {62D1A2A0-9D45-447C-ACD0-17F273E21762}
Visual Studio 2005 Freezes when building BizTalk projects
Have you ever seen VS2005 freeze when building BizTalk projects? I have and it was not a pleasant experience. In search for a solution back in October last year, I meticulously collected info about my environment and posted it on MSDN Forums. I just ran into this problem again today and I saw that someone responded to my post with a solution that actually works! Even though the solution is ridiculous it worked for me. Thank you Hema!
BizTalk Assembly Checker Tool
Check out the BizTalk Assembly Checker tool out on codeplex. I wish I had known about this tool before because it would have saved me some time when doing production deployments with multiple servers. This tool allows you to verify that your BizTalk assemblies are present on all of your BizTalk servers. Once you run the verification, you can also copy the assemblies from one BizTalk server to the GAC of all the other BizTalk servers. This means you only need to login to one of the BizTalk servers when deploying.
BizTalk MSI Fails on Install (Exception from HRESULT: 0×80131047)
Event Type: Error
Event Source: BizTalk Server Deployment
Event Category: None
Event ID: 769
Date: 9/11/2007
Time: 5:56:57 PM
User: N/A
Computer: MN-BTS06R2CTP1
Description:
An error occurred while attempting to install the BizTalk application: A file load exception occurred while attempting to install the assembly into the Global Assembly Cache. This error may occur if the assembly is delay signed, or if assembly was renamed after creating/signing.
The given assembly name or codebase was invalid. (Exception from HRESULT: 0×80131047)
Solution (Update 9/19/2007 3:49PM):
It turns out the culprit was in the script that generated the MSI. I had the following two BTSTask Commands in my script.
BTSTask AddResource /Source:AssemblyA.dll” /Destination:”%%BTAD_InstallDir%%\AssemblyA.dll” -ApplicationName:%AppName% -Type:Assembly -Options:GacOnInstall
BTSTask AddResource /Source:AssemblyB.dll” /Destination:”%%BTAD_InstallDir%%\AssemblyA.dll” -ApplicationName:%AppName% -Type:Assembly -Options:GacOnInstall
Notice how the /Destination switch for the second command specifies AssemblyA.dll? This should instead be AssemblyB.dll.
Accessing envelope values using BizTalk EDI
I recently received this question by email and I figured I would address this as a blog post.
"I have a 1000+ TP Environment who do Medical billing with us. I have custom envelope values for each of them. I need dynamic routing of messages to them
1. Receive EDI File
2. Custom Promotion of thier ISA and GS Values in Recv Pipeline
3. No Orchestration
4. Custom Send Adapter [determine their end point file UNC]
I am missing the place where I can wrap his outbound message with his Envelope values?
I am not sure I fully understand the question but I can suggest some products that do EDI well. It really depends on what version of BizTalk you are using. If you are using the Base EDI adapter in BizTalk 2006 R1, then you will have to write a custom pipeline component that parses your EDI files and promotes the ISA, GS, and ST segment values. In my search, I found a custom solution which is a replacement of the EDI stack in BizTalk 2004/2006. I was unable to find the original author or site where I found this code. You can download it from here. Please use this code at your own risk.
If you are using BizTalk 2004, then I would highly recommend the Covast EDI Accelerator. This accelerator has a cost but it contains a lot of functionality.
If you are really looking to build a robust solution without any accelerators, then I would recommend BizTalk 2006 R2. R2 has native support for EDI and AS2. Check out the following post to see a comparison of all the features in the recent BizTalk versions. You can also download a CTP of BizTalk 2006 R2 from http://connect.microsoft.com
Using Fiddler2 with BizTalk HTTP Adapters
Fiddler2 is a great tool to use when you need to monitor or debug your HTTP traffic between any two endpoints. In fact, it automatically starts monitoring your Browser traffic when you start it up. It is especially helpful when you need to debug HTTP calls from BizTalk. However, you will notice that Fiddler will not automatically capture BizTalk’s traffic. Fiddler acts as a proxy which routes all your HTTP traffic from programs that use the WinInet HTTP module. IE, Microsoft Office and a number of products use WinInet. However, BizTalk does not use WinInet. So you need to tell BizTalk to route all traffic through fiddler. This can be done one of two ways:
1. Configure the proxy on the Send Handler of the HTTP-based adapter
Note that the port number is 8888. This is Fiddler’s listen port (see below). This option requires you to restart the host that this handler belongs to.
2. Configure the proxy on a send port of a HTTP-based adapter
Issues when reusing Virtual Server or VMWare baseline images
Read the event log entry below and you will know what types of issues you can run into if you do not use supported cloning tools such as sysprep or newsid. I got this error in a scenario where a standalone (non-domain member) BizTalk server was using the SQL adapter to push data to another standalone (non-domain member) SQL Server machine.
Event Type: Error
Event Source: MSDTC
Event Category: CM
Event ID: 4101
Date: 6/1/2007
Time: 10:47:59 AM
User: N/A
Computer: <COMPUTER NAME>
Description:
The local MS DTC detected that the MS DTC on <COMPUTER NAME> has the same unique identity as the local MS DTC. This means that the two MS DTC will not be able to communicate with each other. This problem typically occurs if one of the systems were cloned using unsupported cloning tools. MS DTC requires that the systems be cloned using supported cloning tools such as SYSPREP. Running 'msdtc -uninstall' and then 'msdtc -install' from the command prompt will fix the problem. Note: Running 'msdtc -uninstall' will result in the system losing all MS DTC configuration information.
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

