Home > BizTalk > Configuring BizTalk 2006 R2 with Enterprise Library

Configuring BizTalk 2006 R2 with Enterprise Library

BizTalk is a powerful tool with a lot of out of the box features. However, there are varieties of tasks you would prefer to de-couple from BizTalk and delegate to an external framework specifically built for it. When I design software, I always pay attention to the post-deployment configurability of an application.  I always choose an approach that lets me easily change connection information, logging, exception handling, inject some logic, etc. The Microsoft Enterprise library resolves such issues perfectly. So, how would one configure BizTalk to recognize and use Enterprise library?  The answer is trivial and this blog’s purpose is just to document steps I performed to make it happen.

The first step was to install Microsoft Enterprise Library in the GAC. You can find detailed instructions in the help. I would also suggest reading Tom Hollander’s blog about managing Enterprise Library in your organization.

The second step is optional and is related to my habit to have a wrapper around 3rd party framework or solution. I have two libraries Common.Application.Exception with multiple ApplicationException descendents

and Common.EntLib.Logging in order to encapsulate some logic.

Here is an example of ErrorLogEntry with Category and Severity setting.

using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using Microsoft.Practices.EnterpriseLibrary.Logging;
namespace Common.Logging
/// A log entry of category Error. Default priority is High.
public class ErrorLogEntry : LogEntry
public static LogPriority DefaultPriority = LogPriority.High;
/// Default constructor. Default priority is High.
///<param name=”message”></param>
public ErrorLogEntry(string message) : this(message, DefaultPriority) { }
/// Constructor with basic log entry information.
///<param name=”message”>Message to be logged.</param>
///<param name=”priority”>Priority of the log entry (low, high, etc.).</param>
public ErrorLogEntry(string message, LogPriority priority)
: base()
Priority = (int)priority;
Severity = TraceEventType.Error;
Message = message;

Obviously, these Libraries has to be signed and deployed to the GAC 

The next step is to configure BizTalk run-time.  Before you do it, DO MAKE A COPY of BTSNTSvc.exe.config. Then open Enterprise Library Configuration console pointing to the BTSNTSvc.exe.config under C:\Program Files\Microsoft BizTalk Server 2006 folder and configure application blocks you intend to use within yours BizTalk applications.

To test an enterprise library call, I have created a simple orchestration with a receive shape and trigger message.

I also added Expression shape to call Enterprise Library.

Dropping trigger message into configured location produces expected Event log message.

I modified configuration by adding new Flat file trace listener

Then I added new trace listener to the Debug category .

The result appeared in two different destinations without modifying any BizTalk artifacts.


Technorati Tags: ,

Categories: BizTalk
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: