Category name:Uncategorized

Customizing the BizTalk Software Factory

With the release of the BizTalk Software Factory for BizTalk Server 2010 a lot of people ask me what it takes to customize the way it works. They know the factory could help them with development of BizTalk applications, but current company standards are preventing them.

The BizTalk Software Factory (BSF) contains best practices and coding + naming conventions and they typically are not the same in all companies. This fact limits the usage of the BSF or the company need to adjust its coding convention to the BSF, which is not very likely.

This blog post outlines how easy it is to change the default behavior of the BSF to suit your companies coding conventions. Extensibility in Visual Studio 2010 became so much easier that is shouldn’t hold you from adjusting the BSF to your needs.

If you’re new to the BSF I recommend to read the documentation first.

Adjusting the BSF actually is quite easy, the GAT/GAX prerequisites are already installed. First, grab the code from CodePlex by clicking on the ‘Download’ button.

You’ll end up with a ZIP file with all sources from all versions of the BSF. Extract it and just delete the versions you don’t need and keep the ‘BizTalkSoftwareFactory for BizTalk Server 2010’. Open the solution in Visual Studio 2010 and you’ll see this project structure.

In general the actions done by the BSF are stored in so called ‘Recipes’. A recipe contains the steps, dialogs/wizards and actions that are to be executed when a recipe is started. The main recipe for generating the project structure can be found in the ‘Recipe’ folder and is called ‘CreateSolutionRecipe.xml’. If you’re curious take a look at it, but be warned that it is quite difficult to read (let alone debug). The actions called from within a recipe are partly included in the GAX/GAT libraries and the custom ones are in the ‘Actions’ folder.

What template is being used for a certain recipe is specified in the ‘BindingRecipe.xml’. If you open that file you’ll see for example that context menu item ‘Add Map’ is bound to the ‘ItemsBizTalkMap.vstemplate’ (in the templates folder) and that file refers to a recipe named ‘NewItemMap’ (which is the name of the recipe stored in the file ‘NewItemMapRecipe.xml’.

This was just to show you the complexity behind the BSF, but changing the template is not complex at all.

The most important part of the solution for this blog is the ‘Templates’ section. There you’ll find the templates that are used during generation of the project structure.

For creating the project structure and adding the individual items, templates are being used like the ones specified in the ‘Templates’ folder.

  • Items – template items that can be added from the context menu, like a map or schema
  • Overview – contains documentation
  • Projects – template projects used in the solution generation, like BizTalk or Class Library projects
  • References – assemblies that are being used in the projects or items
  • Solutions – template solution used in generating the solution generation
  • Text – T4 templates used with adding individual items, used for the deployment framework and unit test generation


Every item needs a vstemplate and one or more source files. The vstemplate file contains the recipe that will be executed and sometimes files that should be copies as part of the recipe. A good candidate for customization is the ‘BizTalkOrchestration’ item. Many companies have a standard way of setting up an orchestration, for example with default exception handling or logging. By creating a template for it, it will be generated by the BSF every time the ‘Add Orchestration’ is selected from the context menu.


Projects contain the non-BizTalk projects, like can be seen in the picture. Here you also find the vstemplate file which specifies which files need to be copied. Looking a the class library, the ‘SampleClass.cs’ is what is added to the class library by default. Customizing this file to your needs will speed up development. In this sample class as well as the csproj file you’ll find variables for naming.

These variables are replaced by Visual Studio when the recipe is executed. By adjusting these values you can use your own naming conventions. You’ll find these variables in every project file. More variables are available on MSDN.


This contains the BizTalk project that is the template for all generated BizTalk projects in the solution. You can customize this as well by adding for example a default file that you need in all projects.


The text section contains the files that are generated using T4 templates. While generating the project structure the ‘Deployment’ section is customized and the ‘UnitTest’ section is used when a new unit test is added using the context menu.

Generating a unit test is initiated from a recipe, which is bound to a context menu. The recipe is of course stored in the ‘Recipe’ folder. By opening for example the ‘NewItemUnitTestMapRecipe.xml’, you’ll find the location where the variables are inserted into the T4 template.

The output is a customized class file which is saved to the project by the next action. You can customize the unit test file by only adding some standard code to the class file or you can further enhance it by inserting more values, which is of course a bit more complex.

Well you have changed the templates, now what?

Like any Visual Studio project you need to recompile the solution. Make sure that you’ve uninstalled the BSF using the Extension Manager.

After compilation you can install the BSF again and run Visual Studio to test your changes.

I hope this post gave an insight in how the BSF works and that it is not that complex to customize it to your needs.

In case you run into any issue or you need assistance, let me know and I’m happy to help you.

Didago IT Consultancy

Howto: Applying Custom Behaviors in WCF

This is more or less a note-to-self because every time I need to write a custom behavior I have to lookup the way to do it. This post should assist me in the future.

A custom behavior is often used to add functionality to the service that basically is not part of the functionality of the service itself like parameter validation. If you put the validation behavior into a separate assembly you can adjust the validation without affecting (and having to re-test) the service. Most of the time writing a custom behavior is not that difficult, it is the configuration that causes trouble. One little mistake and the service refuses to start.

I’m not going to start with explaining what custom behaviors are, because that is described in this excellent MSDN magazine article from 2007 that still applies to WCF 4. If you’re not familiar with this article, I would strongly advise you to read it.

In my sample project I created a sample WCF service on which I want to apply a custom input validation behavior that validates the input based on a regular expression. This regular expression should be adjustable in the web.config of the service.

Behaviors can be applied using attributes in code or via the web.config. Depending on your requirements you need to implement some interfaces. Because I want my behavior to be configurable, I need to implement these interfaces:

  • IEndpointBehavior
    • this determines the scope of the behavior. Options are IServiceBehavior, IContractBehavior and IOperationBehavior
  • IParameterInspector
    • this determines where the behavior intercepts the call.
  • BehaviorExtensionElement
    • this allows a custom configuration element in the web.config

How the IEndpoint behavior and IParameterInspector work or have to be implemented can be found in many blog posts so it will be briefly discussed here. I would like to focus on the way to get configuration from the web.config.

To get information from the web.config into your application or service, there are two options:

  1. AppSettings section
  2. Attribute field on the behavior configuration

Because the setting is behavior specific, I’m in favor of the second option. In this way it is clear that the setting has something to do with the behavior. In the end this would result in such a configuration record.


This is implemented using the code of the class overriding BehaviorExtensionElement. In this class you define the attributes that will be part of the configuration.


Here I declared a ‘ConfigurationProperty’ with the name you find in the web.config and I specified that this setting is a string value and is required. If necessary it is also possible to add the ‘default’ element to the ‘ConfigurationProperty’ attribute to set a default value.

Next this value must be stored in the behavior somewhere, to be used later on in the parameter inspector. Remember that the configuration is read during launch of the WCF service, even without having received one client call!

The value is stored the IEndpoint behavior implementation and then passed to the ParameterInspector. In the picture above this is done in the ‘CreateBehavior’ method. The code below shows the Behavior where also the check is done if the configuration setting is actually there.


If no configuration setting is found, running this service would throw an error on start because the attribute is marked as ‘required’. If the value is empty, then the custom exception is thrown:


Also in the IEndpointBehavior picture you can see that the behavior is only a service side (ApplyDispatchBehavior) behavior and is not applied to the client side (ApplyClientBehavior). These methods are used to inject the behavior in the stack.

Finally we end up in the parameter inspector, where the configuration setting actually is used. The configuration value is passed via the constructor and stored there in a private variable.


With all elements in place it is time to finish the configuration. The section below is located in the ‘system.serviceModel’ section.


Important things to remember:

  • The name of the extension = name of the behavior! So the ‘InputValidator’ extension is added, and that is the tag name of the behavior.
  • The behavior tag is sometimes not recognized by the Visual Studio editor. It is complaining that the behavior has an invalid (=InputValidator) child element and that only some elements are allowed. Ignore this message!
  • Make sure the assembly type of the extension overrides ‘BehaviorExtensionElement’.
  • If you normally use the SvcConfigEditor tool to edit the web.config regarding WCF configuration, then you might run into issues. The tool at first cannot find the behavior and once you point it to it the tool refuses to accept it. Or at least that is what I experience.

Finally it is time to test the behavior. In the sample project there is a ‘Host’ project. Build the solution and run ‘Host.exe’ as administrator.

Next there is a ‘TestAppSampleService’ which will call the service with a valid and an invalid value. You can step through the client to find out what happens. Also the output is written to the console, which can be picked up by DebugView. This results in these test results:


The sample project can be found here.

BizTalk Software Factory For BizTalk Server 2010 Beta

Every new version of BizTalk Server deserves its version of the BizTalk Software Factory (BSF). Due to time constraints I was unable to deliver a 2010 version of the BSF last year, but after a couple of weeks work I managed to finish the beta.

Some things have been changed between the BSF 2009 and BSF 2010. First of all nUnit is no longer part of it. It has been replaced by MS Test that is part of Visual Studio. If you want to use nUnit, you can easily change the unit test project to utilize it. Also the installation is different. Microsoft simplified the way (guidance) packages are deployed, so now there is no need to run a MSI anymore. Instead you run the VSIX file and it will show up in the Extension Manager.

The prerequisites for the BSF 2010 are:

Like with any new version of Visual Studio, Microsoft released new versions of the Guidance Automation Extensions (GAX) and Guidance Automation Toolkit (GAT) and these are necessary to run the BSF.

The great thing is that now you can install them via the Visual Studio Extension Manager and you don’t have to download and install them yourself anymore.

First find the Extension Manager in the menu bar of Visual Studio:

Install in this order the SDK, GAX and GAT from the online gallery:

Next install the BSF 2010. Get the VSIX from the BSF Codeplex site. If you double click the VSIX file, the following dialog is displayed:

Just press ‘Install’ and watch the package getting installed. This process is substantially faster than it was with previous versions of GAT/GAX, and that especially handy during development of the package 🙂

Now the BSF 2010 has been installed, it shows also up in the Extension Manager where you can remove it again if requested.

Please note that this is a beta version of the BSF 2010. Please give it a try and supply me with feedback so I can create a release version.

WCF 4 Binding Decision Tree

WCF bindings describe the set of rules that client and service agree upon in order to communicate. The set of rules to use is determined by the most restrictive of the two. This blog post is meant to assist you in making the right decision.

There are already some good examples on the internet, like this one, but they are limited to WCF 3. To have a customizable drawing available and to extend the drawing with the WCF 4 bindings, I decided to make my own.

Although more aspects determine the exact binding, it is my experience that in about 90% of the cases there are basically 2 questions you need to answer:

  • Is it an intranet or an internet facing service?
  • Do you need to support legacy clients or not?

For intranet scenarios you’ll end up with the netTcpBinding most of the time. If you need to support legacy clients then the only alternative is basicHttpBinding, otherwise wsHttpBinding is what you need.


The bindings in this diagram are the default bindings. If you want to customize for example the basicHttpBinding to be secure, then you actually create a custom binding based on a default binding. If you change things like that you need to have the bindings configuration in the web.config, which can be omitted if you go for the default binding.

On MSDN there is a great resource with information about the so called system provided bindings. The table below is also taken from there.




Mode of Security (Default)

Session (Default)





Basic Profile 1.1

(None), Transport, Message, Mixed

None, (None)





None, Transport, (Message), Mixed

(None), Transport, Reliable Session

(None), Yes



WS-Security, WS-Trust, WS-SecureConversation, WS-SecurityPolicy

None, Transport, (Message), Mixed

(None), Transport, Reliable Session

(None), Yes




None, (Message)

(Reliable Session)

(None), Yes





None, (Message), Mixed

(None), Reliable Session

(None), Yes





None, (Message), Mixed

(None), Reliable Session

(None), Yes




None, (Transport), Message,


Reliable Session, (Transport)

(None), Yes






None, (Transport)

(None), Yes




None, Message, (Transport), Both


(None), Yes




None, Message, (Transport), Mixed







None, (Transport)


(None), Yes


Setting up a BizTalk Server 2010 Developer Edition Base Image

With the release of the new version of BizTalk Server, it is time to build a new virtual environment to play with.

I have a quad core server with 12 Gb memory at my disposal for this purpose so I’m ready to create a Hyper-V image.

The first step is install the basics, in my case:

  • Windows Server 2008 R2 Standard Edition
  • SQL Server 2008 R2 Developer Edition
  • SQL Server 2005 Notification Services
  • Visual Studio 2010 Ultimate Edition
  • SharePoint Foundation 2010
  • Office 2010

Next, get the install files for:

If you download the BizTalk Server 2010 Developer Edition, you’ll have a packed executable. When unpacked, it is expanded into 10060(!) files. The files are split up into two folders with:

  • BizTalk Server 2010 Installation files, including:
    • Adapter Pack (Oracle, SAP, Siebel, SQL)
    • UDDI
    • RFID
    • AppFabric Connect
  • BizTalk Server 2010 Accelerator files, including:
    • HL7
    • Swift
    • RosettaNet

The prerequisites CAB file that is so familiar to BizTalk installations is mentioned in the documentation and is not enclosed in the installation files.

Installation and configuration of BizTalk Server 2010 are basically nothing new. However if you don’t follow the installation guide, you might run into configuration errors. One issue I ran into was that I forgot to set IIS to native 64-bit mode. This is also missing in the installation guide. You can use the following statements for this:

  • cscript %SYSTEMDRIVE%inetpubadminscriptsadsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 0
  • C:WINDOWSMicrosoft.NETFramework64v2.0.50727>aspnet_iisreg -i

This is one area where BizTalk still can be improved, because the error log text file is hard to read and understand. One thing the team did add to the documentation is a “troubleshooting” document.

Next, installation of the LOB Adapters which is an option on the setup screen of the main BizTalk setup. Just follow the steps:

  • Install Microsoft WCF LOB Adapter SDK
  • Install Microsoft BizTalk Adapter Pack
  • Install Microsoft BizTalk Adapter Pack(x64)
  • Install Microsoft BizTalk Adapters for Enterprise Applications

When BizTalk and the adapter pack are installed, then also the new AppFabric Connect is installed.

Next, the ESB Toolkit 2.1. This is just a matter of running the correct MSI. The installation documentation specifies the pre-requisites.

The ESB Toolkit 2.1 must be configured using the ESB Configuration tool, that can be found in the start menu after the toolkit is installed. There you can configure the ESB Exception and Itinerary database and services you want to use. Before you can configure the services, you first need to apply the database configuration. Finally you need to specify the type of configuration to use, File or SSO. For single server installations File is recommended, SSO is more suitable for multi server installations.

Next the individual components of the ESB Toolkit 2.1 can be deployed into BizTalk. In the ProgramFiles folder there is a Microsoft BizTalk ESB Toolkit 2.1 folder with the necessary MSI installer files that can be imported into BizTalk.

There is quite an installation document for the ESB Toolkit 2.1 you can follow. This document contains some catches like the samples depend on the fixed path “C:ProjectsMicrosoft.Practices.ESB” and a call to ServiceModelReg with a not existing parameter “-y”.

The ESB portal is in the ESB Sources that can be found in the ESB Toolkit 2.1 folder. I had some difficulties setting up the ESB Portal, because the SharePoint Foundation 2010 site was in its way so I had to change the port number of the default website. The portal still runs on .NET 3.5 instead of v4.0. and I assume that not much has changed on the portal, also because the assembly info for the portal mentions “Microsoft ESB Guidance for Microsoft BizTalk 2006 R2” and the UDDI code file contains an obsolete call to the configuration namespace. The UI also looks the same.

Finally installation of AppFabric. Default the hosting services are selected but I also want the caching services to be installed. Installation is a matter of waiting and the configuration is also straight forward.

Now I have a (virtual) base image to do some BizTalk 2010 testing on. 🙂

BizTalk Server 2010 Release Date Announced

Today the long awaited release date of the 7th version of BizTalk Server was announced: October 1st, 2010

For this announcement Microsoft refreshed its BizTalk website. There you can  already download the 120-day trial version. What’s interesting and new with this release is the free developer edition which was also already released. In previous BizTalk versions the developer edition cost around $500.

On the product team blog there is a nice post about the upcoming release.


Installing SQL Server 2008 R2 Master Data Services

One of the major differences between SQL Server 2008 and the R2 version is Master Data Services or MDS. Microsoft has added this feature to give users the ability to centrally store and manage master data.

But what is ‘master data’ exactly?

Master data is the data that is supposed to be uniquely available within an organization. Examples are:

  • Geographical information
  • Product information
  • Customer information

It is typically data of which you want to have just a single source of truth. In a lot of companies this information is stored in several databases and locations. This is very risky because changes to that data might not be available to all employees. However it is not only about a single source of information but also about versioning and managing this important information.

Master data services is supposed to solve this.

Microsoft didn’t build this feature from scratch but acquired Stratature in June 2007 for that. It was code named ‘Bulldog’ and the first preview with MDS was released back in November as a CTP, but the RTM was released in May this year.

Prerequisites for MDS are similar to SQL Server 2008 R2, but for MDS also the IIS role is necessary because the MDS manager is an ASP.NET application. The full prerequisites regarding IIS can be found here.

When you start the SQL Server 2008 R2 installation you won’t see anything about MDS, because it is a separate install. So first start the regular installation of SQL Server 2008 R2.

Next, you can find the MSI of MDS in a separate folder on the installation disk.

MDS Folder

Run the MSI to install MDS. After installation the configuration is launched. This configuration checks if the prerequisites are met. If that is not the case, close the configuration and install the missing pieces. From the start menu you can launch the configuration manager again.


Next step is to create and configure the databases.


MDS requires a database to support the MDS manager web application and web services. Click ‘Create Database’ and the wizard is launched.


Specify the Database server and instance to use.


Specify the name of the database to create.


Specify the service account, which will be used by the web application and services to connect to the database.


Specify the administrator account. Take note of the small remark: “You can configure only one account with this permission and cannot change this account later


Last screen is the summary and the creation and configuration process can start. If everything went ok then the following screen is shown.


If you click finish you’ll close the dialog and return to the main configuration screen. Before configuration the system settings were empty but they are filled in now. You can adjust the settings to your needs.


One of the options is to create a database mail profile so the system can send alerts.


Next step is the Web configuration:


With a clean install you can only select the ‘Default Website’, but if you do that the message “This Web site has no Master Data Services application” shows up. To solve this you can create an application in the default web site or create a new site. I decided to create an application.


With the web application in place, you can select the database to use. This typically is the database that you’ve created previously in the create database wizard.



With this set up, the configuration looks like this.


Click ‘Apply’ to apply the configuration and a confirmation message shows up.


After logging on the ‘Getting started’ page of the web application is displayed. This page gives the opportunity to deploy some sample models and data to be able to play a bit with MDS. The application itself looks like this.


Now MDS is installed and configured and ready to be used.

EF 4 error – Cannot convert lambda expression to type ‘string’ because it is not a delegate type

I’m involved in some EF 4 development now and I ran into an error I couldn’t understand. Fortunately I wasn’t the first to experience this so it could be solved. However this is an example of an error description that could have been clearer.

The error was:

Cannot convert lambda expression to type ‘string’ because it is not a delegate type

The solution was:

Add the System.Linq using statement to the code……

I found the solution here.

First Look At BizTalk Server 2010 Mapper

One of the new things in BizTalk Server 2010 is the improved developer experience around mapping and transformation. This is one of the most important things developers will face in integration projects so let’s see this is all about.

If you launch Visual Studio 2010 you’ll see the familiar project templates for BizTalk.

Visual Studio 2010 template

Looking at the icons for the templates (as well as the other icons related to BizTalk development in the next image) it gives a kind of retro feeling. The icons aren’t as sophisticated at the other Visual Studio 2010 icons. It is expected to be fixed in the final version.

Visual Studio 2010 template

I created a simple project with two schemas, a map and an orchestration. The experience with the schema and orchestration is not changed, so let’s go to the mapper.

If you add a map, like current version of BizTalk, the mapping workspace is shown.


It looks quite different from what we know today, but on the other hand it is also familiar. Left and right you can select the source and destination schemas. In the middle you drag the functoids and make the transformation by linking sources nodes to destination nodes. The schema picker itself hasn’t changed. That is a pity, there is a good example in the BizTalk Software Factory on how to reduce the number of clicks that is involved in selecting schemas.

I created a simple source schema with two fields and a destination schema with one field. I added a “concatenate” functoid and connected the source and destination fields like we do today. The tooltip shows what needs to be done with this functoid.




The functoid dialog has been redesigned. The input tab looks like what we have today but is redesigned and the ‘Label and Contents’ tab is totally new. By filling this with the appropriate information, it will be easier to search on.


One of the things that developers complain about in the current mapping workspace is the lack of overview when the mapping gets bigger and more complex. In that situation it is difficult to see what input is mapped to what output and what nodes are connected to a functoid. That is much improved now.

In the next image, I first clicked on a single source node. Then the link from the source, via the functoid, to the target node is highlighted.


The image below shows the result when I click the functoid, all links from and to the functoid are highlighted. In this simple scenario this doesn’t really add value, but for more complex mappings this is very valuable.


What else is new in the mapper?

At the top of the mapping workspace there is a toolbar and in the menu section there is a BizTalk menu with which you can add pages and rename them. This is already available in the current versions of BizTalk.


The toolbar is totally new, it has some interesting options.


The first icon is a switch for the view of the source schema: default tree view or relevance tree view. In the default tree view all nodes in the schema is displayed. In the relevance tree view mode only the nodes that are linked to functoids or destination nodes are displayed. I feel like that this option only works if your mapping is larger than 4 fields.

The second icon is a switch for links between source and destination: all links or only relevant links.

The third icon is a switch for auto-scrolling of functoids, on or off. This switch makes sure that the selected functoid is always visible on the mapping workspace.

The fourth icon is a familiar hand, for switching between normal and panning mode. It allows dragging your workspace.

Then there is the zoom and search option, where you can search in source schema, destination schema and functoids.

The last icon is the same as the first, but then for the destination schema.

Conclusion: the developer experience is definitely enhanced and because this is a first look I haven’t even shown everything that is possible!

If you want to know more about the new mapper, check out these blogs:

What is new in Installing BizTalk Server 2010 Beta?

Anyone keeping an eye on the BizTalk roadmap already knows that the first beta of BizTalk Server 2010 has become available. For those who missed it, Steef-Jan Wiggers has an excellent post on it. Also the list of new things in BizTalk Server 2010 is something that described in multiple blogs, like this one.

Immediately after releasing I built a Hyper-V image with the new beta. The installation experience is quite similar to the current BizTalk versions 2006 and 2009. This post is describing the things that I noticed during installation. Not all screens of the setup and configuration are in this post, just the new things.

When you unpack the beta package, you’ll end up with 5797 files. After launching setup.exe, the familiar welcome screen is shown. Of course it is ‘2010’ everywhere.

The first thing that I noticed when walking through the setup wizard was the mandatory participation in the Customer Experience Improvement Program, but that is understandable for a beta product.


In the installation procedure you can select the components to install and another thing I noticed was that the HWS (Human Workflow Services) are dropped. This was already a hardly used feature but now it is actually gone.


I installed SharePoint Foundation 2010 before installing BizTalk Server 2010 Beta to test the SharePoint Adapter.


The rest of the installation is about the same as in 2006 and 2009.

Then the configuration of BizTalk Server 2010 Beta. The first noticeable thing is that the configurator seems to have problems with the SharePoint Foundation 2010 setup.


SharePoint Foundation 2010 is still called WSS 4.0 here, the previous name of the successor of WSS 3.0. In the installation guide for Windows Server 2008 R2 I was instructed to configure IIS in 32 –bit because otherwise I wasn’t able to run the BAM portal site.

Then, when the installation finished there was another new thing. When configuring BizTalk to run under an account with administrative rights, the Enterprise SSO also succeeds with a warning.


This time I used a dedicated account so that couldn’t be the case. By double clicking on the exclamation mark the error showed up. By using a basic configuration you don’t set a password for the SSO backup file. That is not a best practice so you’re warned for this.

The next configuration error was an expected one, the SharePoint adapter could not be configured because of the 32/64 bit issue.


My conclusion is that the installation and configuration experience hasn’t been changed a lot. Some minor enhancements are made but nothing big.

  • Recent Posts
  • Recent Comments
  • Archives
  • Categories
  • Meta