BizTalk Server - Debugging in Visual Studio.Net 2003

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server > October 2004 > Debugging in Visual Studio.Net 2003





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Debugging in Visual Studio.Net 2003
Craig Beuker

2004-09-29, 8:02 pm

Greetings all,

I have a question with respect to debugging code in VS.net.

I am playing around with building a BizTalk Adapter from scratch, anyways, I
am debugging the thing, each time I rebuild I have to re-attach to the
BizTalk Service exe.

Now, VS.net has option of specifying an executable to start when F5 is
pushed, and the development environment will automatically attach to that
process. This would be **much** easier than manually having to attach to the
process.

So on the [Configuration Properties/Debugging] option of my adapter project,
I set the following properties.
Debug Mode: Program

Start Application: D:\Program Files\Microsoft BizTalk Server
2004\BTSNTSvc.exe

Command Line Arguments: -group "BizTalk Group"
-name "BizTalkServerApplication" -btsapp
"{4021EB62-BF92-4560-8FF3-E1608D92C7B8}"

I grabbed the command line arguments from those passed to the BTSNTSVC.exe
executable from the services properties.

However, whenever I press f5 to build/run my project I keep getting this
event raised by BizTalk 2004 in the event viewer:

Failed while loading the BizTalk NT service.
BizTalk host name: BizTalkServerApplication
Windows service name: BTSSvc{4021EB62-BF92-4560-8FF3-E1608D92C7B8}

Anyone know what I am doing wrong, or if this is even possible? Have any
links to a description on how to get this working, It would save a bunch of
time. I've been digging though the documentation, no luck there, nothing on
the net that I can find either..

Thanks in advance..

--

Craig Beuker
Gilles [MSFT]

2004-10-02, 8:59 pm

Hello,

>I have a question with respect to debugging code in VS.net.
>
>I am playing around with building a BizTalk Adapter from scratch, anyways, I
>am debugging the thing, each time I rebuild I have to re-attach to the
>BizTalk Service exe.
>
>Now, VS.net has option of specifying an executable to start when F5 is
>pushed, and the development environment will automatically attach to that
>process. This would be **much** easier than manually having to attach to the
>process.


You see, BTSNTSVC.EXE is, as its name might suggest, an NT service. The problem with NT services
is that they do not behave as real "programs". They are started and called by the SCM (Service Control Manager).
Essentially, it is not as simlpe as specifying the command line to BTSNTSVC.EXE and pressing F5 because you
are debugging something a little different from a simple application.

The right way of doing is is to write a Visual Studio Macro in VB that performs the following actions:

1) Use BizTalk WMI to stop and restart the host that runs your adapter (this is to ensure that the new version built will be loaded)
2) Use Visual Studio Object Model to iterate throught the list of processes and attach the debugger to this process

Now, bind that macro (I'll call it DebugAdapter) to Shift+F5 or whatever you like and every time you want to debug, press shift f5.
Optionally, you can even include a full build of the solution in the macro.

Note that technically, the first step in the macro is not required for debugging but will save you an invaluable amount of time
by not debugging situations where your adapter has not been reloaded by the host.

The Visual Studio object model documentation is here: http://msdn.microsoft.com/library/d...rl=/library/en-
us/vsintro7/html/vxgrfAutomationObjectModelChart.asp

It is a sensitive chart so clicking on an object will reveal its documentation. You want to see what is available under DTE.Debugger.

Thanks,
-Gilles.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com