Click here to Skip to main content
15,879,474 members
Articles / .NET
Article

BizTalk Server 2006 and Ent Lib 3.1

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
24 Feb 2008CPOL3 min read 25.7K   12   1
Integrate BizTalk Server 2006 development with Enterprise Application Library 3.1

What

The essence of the article is to enable the use of Enterprise Application Block with BizTalk Server 2006 development. Using the Enterprise Application Block in web applications or windows based applications is eased by the use of web.config or app.config respectively. However as the BizTalk server runs as a service on the server the configuration of the application using a app.config is not suitable and does not work.

Why

Being expert .NET Developer, I always wanted to use my expertise in .NET Coding to facilitate the development of maps by using the scripting functoid. The Helper Project developed for this purpose consumed the Data Access Library Project created for a previous project and heavily depended on the Enterprise Application blocks for fetching Data from the database and logging exceptions. However the Data Access Application block kept throwing exceptions in the Event Viewer as BizTalk Exceptions indicating the configuration was incorrect and Logging Application Block never worked.

Approach:

In my approach to Solution Oriented Approach, the simplest solution to a problem is mapping it to a problem whose solution we already know.

Mapping it to a Known Problem:

When you want to use Enterprise Application blocks with a ASP.NET web application we are recommended to open the web.config in the Enterprise Application Block configuration tool. Similarly since BizTalk Components run inside BizTalk Service BTSNTSVC.exe we can do the configuration of the Data Access Application Block and Logging application block in the BTSNTSVC.exe.config[1] file.


[1] The BTSNTSVC.exe.config file is found at Program Files/Microsoft Biztalk Server 2006 folder on your machine.

Road Block:

However unlike the web.config we do not want to clutter the BTSNTSVC.exe.config file with the Configuration Information for the <place w:st="on"><city w:st="on">Enterprise application blocks. The recommended usage is the use of external application configuration files and creating entries in the BizTalk Configuration file to point to these config entries.

Enterprise Application Block Components to Use:

  • Configuration Sources Application Block à File Configuration Source
  • Application Settings – File Source
  • Data Access Application Block

Outlining the Step by Step Approach:

  1. Lets open the File in a Enterprise Application Configuration. Click Start - All Programs -Microsoft Patterns and Practices - <city w:st="on">Enterprise Library 3.1 - <city w:st="on"><place w:st="on">Enterprise Library Configuration
  2. File à Open Application à BTSNTSVC.exe.config

(Note: Please back up the file so that you do not mess the configuration in case something goes south)

Here is how a typical BTSNTSVC.EXE.CONFIG file looks in the Enterprise Configuration Wizard:

Initial.JPG

  1. Right click on the C:\Program Files .. and click new Configuration Sources.
  2. Select file configuration source and select a Configuration File say Config.xml
  3. Now close the application and open the Config.xml file and configure the Data Access Application block by creating Connection Strings and default databases. Save the configuration and close the application.
  4. Now reopen the BTSNTSVC.exe.config file and check out the Enterprise Data Access Application configuration created in the database. Now right click the Application Settings and select an external file for storing the application settings entries. (you might have created this file already using the app.config file)
  5. Once the application settings file and Data Access Application Configuration is complete the BTSNTSVC.Exe.config file will look like this in the Enterprise Configuration Application

Final.JPG

Important Note:

However before you are ready to start writing code in your Helper projects BTSNTSVC.exe needs to be notified about the change in the Config file and hence using the BizTalk Administration make sure you restart the service.

Hurray!!!!!!

The Enterprise Application Block is now ready to use in the BizTalk Application. Now in your helper classes you can do database connection using the

<p><code>Database db = DatabaseFactory.CreateDatabase("MyDB");

OR You can log using

Applicatio<code>nLogger.LogException(ex, “Exceptions”);

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader Gallop Technologies
United States United States
I am a .NET Developer who has evolved into a BizTalk and MOSS 2007 consultant.

Comments and Discussions

 
General[Message Removed] Pin
immetoz6-Oct-08 7:52
immetoz6-Oct-08 7:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.