Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

How to debug a complex solution

I am busy developing a distributed application. I decided to make the client a windows forms application (C#) that talks to a webservice (responsible for the database stuff). I also have a layer of logic between the webservice  and the client (for making the proxied objects smart, ie. wrapping them up).

Bugger: I just can't figure out how to set the various options, so when I start debugging the client, I can also step into the webservice code.

I am running an IIS on my local maschine. DB (Firebird) is also local.

Has anyone done this before?

Daren Thomas
Monday, April 05, 2004

Assuming you've got your webservice compiled as a debug DLL, and your web.config is set for debug, just attach VS to the aspnet_wp.exe executable, and attach to the webservice.  Set a breakpoint in your code, and you should be good to go.

Greg Hurlman
Monday, April 05, 2004

Thanx. So far, though, I have all the projects in one solution. If I attach VS to the WebService, it blocks - no way to start the Client. I guess, I will just have to make two solutions... Pity though, but it sort of relates to debuging ActiveX-EXEs in VB6.0.

Daren Thomas
Tuesday, April 06, 2004

Duh... OK, now it seems to make sense: A debugger can only attach to one process at a time. The WebService must run in a seperate process, ergo can't be debugged with the same debugger instance as the rest of the application.

Daren Thomas
Tuesday, April 06, 2004

Hi Daren,

>> Duh... OK, now it seems to make sense: A debugger can only attach to one process at a time. <<

The VS debugger can indeed attach to multiple processes simultaneously. Just go to your VS solution's Properties > Common Properties > Startup Project property page and select the "Multiple Startup Projects" option. Make sure on this property page that the start actions of your web server and your web service client are both set to "Start".

Then on the web service project's Properties > Configuration Properties > Debugging property page, change the Start Action option to "Wait for an external process to connect".

In your web service client (the Windows Forms app), after creating the web service proxy, set the proxy timeout property to -1. This prevents any calls to the web service from timing-out while you're stopped at a breakpoint within the web service.

You may also at some point want to debug the web service proxy class. To do this, remove the class attribute called System.Diagnostics.DebuggerStepThroughAttribute.

HTH,

Mark
------
Author of "Comprehensive VB .NET Debugging"
http://www.apress.com/book/bookDisplay.html?bID=128

Mark Pearce
Tuesday, April 06, 2004

Great, Mark! I will try that first thing tomorrow morning!

Daren Thomas
Tuesday, April 06, 2004

If you add the "Network Service" or ASPNet user account to the "Debugger Users" group, VS.Net will auto-attach to the web server and allow you to step inside of the Web Method from the Web Client.

RichB
Monday, May 10, 2004

*  Recent Topics

*  Fog Creek Home