BizTalk Orchestration debug

You can debug your orchestration using Visual Studio by attaching it to BTSNTSvc.exe processes. The orchestration will be debugged without break point if it has Exception,
in this case you will not need to setup a break point, like any desktop application which you run in debug mode.
The engine will generate C# file for you were you can details of the exception.

In this post I want to show how to debug an orchestration setting a break point

I will create an orchestration which will throw an exception when dividing by 0 (Zero)

Create a simple schema where you will pass 2 numbers
and another schema with 1 parameter which will hold division result.

All element should be decimal and distinguished

1. Create Receive port in orchestration
2. Create Scope
3. Add Construct message to Scope
4. Add Message assignment to constructor
5. Create Send port

Edit expression for assignment:

Variable_1.LoadXml(@"<ns0:root ns0=""http://OrchDebug.DivisionOut""><result>14.4</result> </ns0:Root>");
MessageOut = Variable_1;
MessageOut.Result = (MessageIn.x / MessageIn.y);

where Variable_1 is System.Xml.XmlDocument variable in the Scope
Change namespace and parameters if needed.

At the end your orchestration should look like
Now create two file adapters to receive parameters and send the result
Deploy BizTalk project and bind orchestration ports

For the first time input simple right numbers for x and y
Check the output that result is OK.

then insert 0(Zero) for y which will produce Exception in orchestration
In Event Viewer you will have the exception description

xlang/s engine event log entry: Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'OrchDebug.Division(6ec96fde-7908-1b3e-f21d-244ab1fe40fa)'.
The service instance will remain suspended until administratively resumed or terminated.

Open Group Hub in BizTalk Management Console

check for suspended messages you will see there new Resumable message

open that message in list and right click on it

Start debugger

in this case you can see the shapes and setup a break point.

Then just attach your visual studio debugger to BTSNTScv.exe
and debug it like a windows server or Web application

after attaching to debugger put new file in receive directory and check your visual studio, it will debug your orchestration.

Comments

Popular posts from this blog

How to poll database using WCF-SQL adapter

SQL query timeout from application but works fast from SSMS