Sign and GAC your BizTalk 2006 Custom Pipeline Components ASAP

Recently I was working with a custom pipeline component in BizTalk 2006.  As you know, a change was made to how these components behave in BizTalk 2006.  That is, now they can be placed in the GAC as well as in the \Pipeline Components directly.  So what does this mean?  Put them in both place, one place, who knows?

In general, the rule is when working with custom pipeline components on a development system put the components in the \Pipeline Components folder and put them in the GAC on non-development systems.  Although this is not really the approach the help guide says (under Developing Custom Pipeline Components), this approach works great since it simplifies deployment.

Today, I found a big GOT YOU with this approach if the custom component is not GACed before it is used inside the designer.  All in all, you must GAC the custom pipeline components as soon as your create them and BEFORE adding them to the Visual Studios Toolbox.

Let's take a look at what happens when you add an unsigned and unGACed custom pipeline component to a project.

When you add the component to the Toolbox and drag it into the design surface, a reference is added to the pipeline component.  As seen below, when the component is not signed and not in the GAC a reference is added to the component in the \Pipeline Components folder.

Fig 1: Unsigned and unGaced 

Now, let's take a look at what happens when you add a signed and GACed custom pipeline to a project.

When you add the component to the Toolbox and use it in a pipeline, a reference is added to the pipeline component (as before).  But this time, the signed and GACed pipeline is referenced to the GACed version of the pipeline component as seen below.

 

Fig 2: Signed and GACed

So why does this matter?  Well, the problem I ran into was I added my custom pipeline component to my pipeline before I signed and GACed it.  So when I went to deploy my solution to the development server with the pipeline component only in the GAC, I got a .net error saying it could not find the pipeline. 

Something else to point out is that the pipeline must be GACed before you add the pipeline component to the Toolbox.  Just being signed is not good enough.

The moral of the story: If you only want to put your component into the GAC and not into the Pipeline Component folder make sure you GAC it before you use it.

BizTalker Volume 6: BAM Reduce the Barrier to Entry

The latest edition of The BizTalker has been released. 

This issue headlines Brennan O’Reilly from EMC’s Microsoft Practice in Bellevue, Washington.  He covers Business Activity monitoring (BAM) and talks about how easy it is to get up and running with BAM in no time. 

View this issue online or subscribe now to make sure you do not miss an issue. 

Currently, The BizTalker is published every few months to over 1250 people worldwide.

 

BizTalk Server 2006 Developers Guide released by Microsoft

If you happen to have a few extra hours of free time, you might want to read the new BizTalk Server 2006 Developers Guide. 

At first glance, this 133 page troubleshooting & development guide looks awesome and covers BizTalk from end to end.

Some top topics include:

  • SQL Adapter
  • SQL Deadlocks
  • Troubleshooting Maps
  • Common Errors through out BizTalk
  • Troubleshooting Web Services
  • Much much more.

It’s well worth a look.

Multiple Binding Files in an Application

This sample shows how to use multiple binding files inside an Application to allow for one MSI to be used on multiple target environments. When you add multiple binding files as resources to your application, a drop list will appear when you import your MSI on your target environments.

This sample works with BizTalk 2006 and BizTalk 2006 R2.

Get more information from the original blog post on this topic: http://www.biztalkgurus.com/biztalk_server/biztalk_blogs/b/biztalk/archive/2006/09/12/how-to-add-multiple-binding-files-to-an-application-in-biztalk-2006.aspx

How to Add Multiple Binding Files to an Application in BizTalk 2006

BizTalk 2006 makes it easy to add multiple binding files to an Application.  By adding multiple binding files to an Application, you can easily select environment specific settings during deployment. 

So if you have a Dev, Test, and Prod environment you can have three binding files all built into the same MSI package.  Of course, you need to create and maintain multiple version of your binding files in order to use them in this manner.

To add multiple binding files to an Application, just follow these steps.

1.  Export your binding files using BizTalk Server Administration (you'll need to change your setting for each environment).

2. Once you have all the binding files, inside BizTalk Server Administration add them as a Resource to your Application.

3. Add each Binding file and specify the Target Environment name.

4. Repeat for each Binding file and make sure the Environment variable is set for each file.

5. Create your MSI for your Application.

6.  When you import your MSI on another Environment, you will get a selection menu to select what binding file you want to use.

 

I've put together a simple sample to show this.  It will not actually run or do anything.  It is just intended to show how to set up multiple binding files.

Download: Multiple Binding Files in an Application

 

Simple Script to Terminate All Orchestration Instances

Tired of having to go into BizTalk Server Admin and terminate any suspended Orchestration instance before you want to redeploy?

Scripting this task is very simple using WMI. Just create a file called Terminate.vb and copy in this code:

TerminateAllOrchs

Sub TerminateAllOrchs

  Query = "SELECT * FROM MSBTS_ServiceInstance where ServiceClass = 1"

  Set InstSet = GetObject("Winmgmts:!root\MicrosoftBizTalkServer").ExecQuery(Query)

  For Each Inst In InstSet

    Inst.Terminate

  Next

End Sub

Running the script will terminate all Orchestration instances.

Note: This will terminate all Orchestrations so please use caution.

It could be further parameterized to only terminate specific Orchestrations.  The Query would look like:

Query = "SELECT * FROM MSBTS_ServiceInstance where ServiceClass = 1 and AssembliName='<name>'"

With <name> being the Assembly name of the Orchestration.

If you are using a helper .net class in your Solution, you can set this up as a pre or post build event so every time you deploy you'll not have to worry about deployment errors due to suspended Orchestration instances. 

To set this up, just put the path to the vb script file in the event text box.

Again, I better stress this should only be used in cases that you are sure terminating all Orchestrations is what you really want to do.  But it can be a great time saver for development.

How to Auto-GAC your BizTalk Helper Classes on a Successful Build

Working with helper .net classes with BizTalk is a common task. 

 

Sometimes it can be easy to forget to GAC the latest version of the code when you go to test the solution on your local development box.  With a simple Post Build Event, you can have your code automatically put in the GAC for you. 

 

Adding the post build event is easy.  Just go to the project properties of your helper class and select Build Events. 

 

Enter the following under Post Build Event:

 

"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" /i $(TargetPath)

 

Now when you build your code your dll will be GACed for you.

Native serialization error Root element is missing Map Error

Recently I was testing a BizTalk map inside Visual Studios.  The input schema was auto generated using the SQL Adapter and the output was a simple text file.  I was using a sample file provided to me from a past generation from the schema (or so I thought) to test the map. 



When I was testing, I keep getting a blank file as output and a strange error.  The error was: Native serialization error: Root element is missing. 



I had both input and output validation turned on and the input sample file was passing validation.  To confirm this, I took the schema and sample file and confirmed it validated using Visual Studios. 



Since I was not having much luck testing inside Visual Studios, I decided to set up a send & receive port and test the map through BizTalk to see if I could get different result.  This time, I got a subscription not found error.



Odd, since the schema and maps are all deployed.  I check the message that was suspended and noticed it was not mapped; my original message was published and suspended. 



This could only mean the message type was wrong – somehow.  So I took a closer look at the namespace in the sample message.  It was slightly off!  I corrected the namespace in the sample file and everything worked fine.



Overall, the moral of the story is three fold:



1.          Schema Validation inside BizTalk DOES NOT validate namespace; at least it doesn’t if there is only one.


2.          When you get a strange mapping error with no output, check your namespace!


3.          Use extreme caution when typing in the namespace fields when using the SQL Adapter.  Evidently in a past test the namespace was typed incorrectly.  When the SQL Schema was auto generated, this wrong schema was use to make the sample file I was using.



This took me over an hour to figure out so I guess I’m getting rusty at testing BizTalk maps.  Hope this helps someone else out down the road.


Splitting Out POP3 Email Attachments

This sample shows how to receive an email via the POP3 Adapter and break off unlimited attachments as separate messages. Each message will be saved to a folder location. Note that this sample is not fully functional; you need to set up the POP3 Receive Location yourself to an existing email address.

This sample will work with BizTalk 2006 and BizTalk 2006 R2.

Get more information from the original blog post on this topic: http://www.biztalkgurus.com/biztalk_server/biztalk_blogs/b/biztalk/archive/2006/08/08/how-to-split-received-email-attachments-in-biztalk-2006.aspx