Tuesday, 25 January 2011

Cannot create new BizTalk projects in Visual Studio 2008 - "Project Creation Failed"

Sometimes when trying to craete new Biztalk project in VS 2008, we may encounter is error.In addition to this error in IDE, a Warning also will be generated in Application Log as "One or more templates do not match any installed project packages."

The reason is Biztalk projects are internally treated as C# projects. So during any reapair or update to VS 2008 , a registry entry will be overwritten.

We have 2 solutions for this issue.

1.Doing a reapair to Biztalk Server will solve the issue as during Biztalk installation the registry entry will be updated to support Biztalk Projects. You can either run the Biztalk Installation -setup.exe or directly go to Control Panel->Programs and Features->Add/Remove Programs->Biztalk Server 2009 -> Repair.

2. Change the value of the following registry entry from csproj: to csproj;btproj.

The Registry key will be available at

For 32-bit versions of Visual Studio 2008:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Projects\{FAE04EC0-301F-11d3-BF4B-00C04F79EFBC}\PossibleProjectExtensions
For 64-bit versions of Visual Studio 2008:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0\Projects\{FAE04EC0-301F-11d3-BF4B-00C04F79EFBC}\PossibleProjectExtensions

Thursday, 20 January 2011

Error "TOMTreeGenerator.GetElementAbsoluteType: Object reference not set to an instance of an object".How to resolve this Error while performing UnitTesting for Schemas ?

This error occurs because of the schema testing limitation for the Schemas containing any imported schema/schemas.

This can be overcome by creating custom method, (instead of using the ValidateSchema method created by the BizTalk) and writing manual code to test the Input XML against the Schema.

(For eg: using XmlReaderSettings methods or any other possible methods whatever you think will get the logic done.)

Can we use Non-Serializable Classes or Types in an Orchestration ?

Biztalk is entirely Stateless. This is achieved by using Persistence Points. Incase of any failure during the processing of an Orchestration (for eg: power failure or Server Restart etc) BizTalk Server will continue to restart the Orchestration from the Last Persistence Point.

Details about the Persistence points will be Stored in BizTalk SQL Server DataBase by serializing all the data.

Hence Non-Serializable Classes or Types cannot be used directly in Orchestrations.

Don’t worry, we can use them in orchestration with an Atomic Scope.
Because persistence does not happen within an Atomic scope. The persistence point is created only when the scope completes its execution as it’s an All-or-Nothing scope.So, we can use Non – Serializable Classes or Types inside Atomic Scopes in an Orchestration.

Consider the below Sample:

1. Create a new BizTalk Project and add any dummy Schema.



2. Create a new Orchestration and add a receive shape to receive the message of the Type Schema1 which is created in Step1.



3. Create two variables of types System.Xml.XmlDocument and System.Xml.XmlNode


4. Now add an Expression shape to the orchestration and add code to extract a node from the incoming message and assign that to the variable you created in step3.



5. Try to build the solution. You end up with an error as shown below.

Error 1 a non-serializable object type 'System.Xml.XmlNode xmlnode' can only be declared within an atomic scope or service.

6. To resolve this, make the following changes to the solution.

     i. Click on the white space of the Orchestration and make the Transaction Type of the Orchestration to Long Running.



     ii. Add a Scope Shape and set the Transaction Type of the Scope to Atomic and move the Expression shape inside the Atomic Scope.



     iii. Move the xmlnode Variable inside the Atomic Scope.



7. Now build the solution. It should work without any errors.

This is just an example. Although this approach is useful, this should be avoided for performance reasons. Alternatives such as XPaths should be considered.

Hope it Helps.

- Shiv
Web Counters

Tuesday, 18 January 2011

First Check in Deployment - For Beginners

A must to do check, before deploying an application - is to check in which server you are deploying.

This can be found in the Project Properties -> Deployment Tab -> Server.

By default it should point to your server.

But incase if you copy the project from some other machine and open in your's it will continue to show up the old machine name. If you now try to deploy without changing the Server name, it tries to deploy in the old machine and not in yours.

Hence, check, in which server you are deploying before you start to do so.

Else, Change the Server name to "." (period). This will then always deploy in the local machine, where you open the solution irrespective of from where you copy that.

- Shiv

Useful Tip for (Developers) Deploying Multiple Projects to Admin Console

Working in Real time BizTalk Server Solution generally involves deploying multiple BizTalk Server Projects in Admin Console. (I work in a BizTalk Solution where there are 15 Projects to be deployed for the entire solution)

In this scenario, Instead of setting an application name for each of the BizTalk Project and deploying them, Create a Default Application in Admin Console and Deploy all the applications). This default application can then be exported to a MSI File.

This will save us the time to give application name for each of the project individually.

Moreover, though you provide any application name for each project, it will not be saved in TFS. Whenever you get a new workspace, you have start all over again.

In these scenarios default application trick works perfect.

Note:  This is useful for the first time. However, once deployed, individual projects can be redeployed without  the need to deploy the whole solution.
Otherwise, the dll of the individual projects can be reinstalled to GAC. This should be followed by Restarting Host Instances.

- Shiv

Using Post & Pre Deployment Scripts

Sometime we may need to do some preprocessing tasks before the MSI Files are imported (in Admin Console) on the QA/Prod Servers.
This my include, but not limited to, creation of Folders for FTP/File Adapters, Building & Installing any assemblies to GAC, moving the necessary dlls to the bin folder etc.

Instead of doing these activities at each time a MSI file is deployed, it can be automated using a Pre/Post Deployment Script.

1. Create a batch file (.bat file) for the pre-processing tasks to be done.
2. Test it and add it the Application in Admin Console in Development Machine. (Right Click on the Application in BizTalk Admin Console -> Add -> Pre/Post Processing Script
3. Export the application to an MSI File.
4. Copy that MSI File to QA/Prod or any other Server and Import the MSI File.

When this MSI File is imported, you observer that the Scripts are execute.

- Shiv

BizTalk Map Documentation

An excellent utility which every developer need in their project.

This exe file can be used to transfrom your BizTalk Map into an HTML file for documentation purpose. This can then be copied to an Excel file easily.

You can find all the details here.

- Shiv

Monday, 10 January 2011

Reset BizTalk Server MsgBox Database – Useful for all Developers

Did you find your Development Machine performing slowly.., its time to clean up the Message Box and Tracking Data..

** This should be executed on the development/test machine only. Executing this in Production will lead to loss of data **

Here are few steps to clean up BizTalk Message Box Database.

1. There is a Stored Proc bts_CleanupMsgbox in BizTalkMsgBoxDb Database. By default this stored proc does nothing. It’s Dummy. This is to prevent accidental execution in the Production Server.

2. Execute a script to recreate bts_CleanupMsgbox. Script can be found at <BizTalk Dir>\Schema\msgbox_cleanup_logic.sql. This script should be executed in BizTalkMsgBoxDb Database.

3. Stop BizTalk services from the Services (Start -> Run -> Services.msc).

4. Reset IIS server incase if you have any running isolated host instances

5. Execute stored procedure bts_CleanupMsgbox on your message box database

This SP will take an input parameter @fLeaveActSubs.
Values for this should be '0' or '1'. '1' is the default incase if you dont supply a value.

Setting the value to '0' results in clearing the active subscriptions and you may have to redeploy the application. Think twice before doing this.

6. The above will not clear off all the subscription but will mark for deletion . Execute the stored procedure bts_PurgeSubscriptions on your message box database to purge them all.

7. Start BizTalk services

To clean up the Tracking data in BizTalkDTADb Database

1. Stop BizTalk services from the Services (Start -> Run -> Services.msc).

2. Execute stored procedure dtasp_CleanHMData on BizTalkDTADb database.

3. Start the BizTalk services

- Shiv

Web Counters