In BizTalk 2009 and BizTalk 2010, there are often problems when installing the ESB Toolkit but then it (almost) always works well. In BizTalk 2013 The BizTalk Server installer now provides the option of installing ESB Toolkit as well. The configuration process is also much simpler so you would think it’s now more integrated with BizTalk Server 2013. Unfortunately, that is not entirely true. Installation has indeed become easier but also there are some new bugs added!

A great feature of the ESB Toolkit is that you can use business rules to select an itinerary based on the content of a received message. But when you have configured an Itinerary Selector pipeline component in BizTalk 2013 to use a business rules policy to select the appropriate itinerary, you get the following error:

“Exception has been thrown by the target of an invocation.”
On the BizTalk ESB Toolkit Forum you can see that other users also have this problem so it’s starting to seem that this is a bug!


Identifying the exact error

The error “Exception has been thrown by the target of an invocation.” is to generic and doesn’t help very much but combined with Error StackTrace you see which .dll file, the method and the object that creates the error. As is often your best friend is Reflector so let’s have a closer look at the “ResolverFactory.Create” method in the Microsoft.Practices.ESB.Resolver.dll.

Yeah but what now? Let’s try to copy that piece of code into a new solution in Visual Studio and run and debug it.
Ok, I can now see that an instance of the “Microsoft.Practices.ESB.Resolver.Unity.ResolveProvider” object is going to be created. That’s a bit more information but combined with the Inner Exception, we know what’s really going on.
InnerException: “Unrecognized element ‘typeConfig’. (C:\Program Files (x86)\Microsoft BizTalk ESB Toolkit\esb.config line 153)”


How to fix the bug

The “Microsoft.Practices.ESB.Resolver.Unity.ResolveProvider” object in the ESB Toolkit 2.2 uses the Microsoft Enterprise Library 5.0 and Unity 2.0. When you google/bing on “Unrecognized element ‘typeConfig’.” and Unity, it becomes clear that Unity 2.0 uses a new streamlined configuration schema for configuring Unity. Therefore, the esb.config file from the ESB Toolkit must be modified.

The following adjustments should be made:

  • Remove the <typeConfig> element
  • Change the <typeAlias> element to <alias>
  • Change the <type> element to <register>.
  • Remove the <containers> elements and <types> elements.

For more information see The Unity Configuration Schema in Unity 2.0.

Changes in file: C:\Program Files (x86)\Microsoft BizTalk ESB Toolkit\esb.config


Testing the changes in the esb.config

I used the sample How to: Select an Itinerary Using a Business Rules Policy to test the changes, but first I changed the machine.config file to be able to see BizTalk ESB Toolkit trace output.

To enable the BizTalk ESB Toolkit trace switch, add the following <switches> element to the system.diagnostics section of the Machine.config file.
          <add name="BizTalkESBToolkit" value="4"/>

.csharpcode, .csharpcode pre
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
background-color: #f4f4f4;
width: 100%;
margin: 0em;
.csharpcode .lnum { color: #606060; }

Now when you receive a message in BizTalk you can see the trace output from the ESB Toolkit. In the last line you can see that the itinerary is found and added to the cache!



These adjustments in the esb.config file are not exactly rocket science yet it has taken me a long time to find the exact error and make the proper adjustments because the original error message was to generic and you have to perform a lot of work to find out what’s going wrong!

You can download the updated esb.config file here: