views:

33

answers:

3

Suppose I have a class library cl1 and a unit test for it that is called clt1. I can use Visual Studio's Attach to Process feature to attach to NUnit runner. This lets me debug cl1, for example set break points. It's a very helpful feature for debugging.

I'm in a need of this technique in Visual Studio and IE/FF. Suppose I have a web application that utilizes cl1. This application is running via ASP.NET Web Development Server or IIS. I want to debug (set break points) in cl1. How can I do this?

Please notice that it's not possible through Visual Studio itself. Because something in markup is calling cl1 classes and I can't set a break point in ASP.NET markup. I'm running Visual Studio 2010 Ultimate.

UPDATE:

cl1 is running as server side

A: 

I guess the class library you are referring to contains c#/vb.net code (server side) so as the code is executed by the server you will need to attach to the webserver itself. If the web site is hosted at another machine you can use VS remote debugger to attach to IIS.

Giorgi
@Giorgi, So how can debug via webserver?
afsharm
A: 

As your code is running server-side, you need to attach the debugger to the server (IIS, or dev server, whichever you are running).

What I normally do is set my breakpoint, browse to the site (in order to ensure that the site is running and has been "warmed up") then Debug -> Attach and find the process running the web server to attach to. I then browse to where my code will be run and go through the steps to execute it.

If IIS is running on a different server, you can do remote debugging.

Oded
A: 

Your library will be running inside the ASP.Net app pool. On IIS7 you should attach to w3wp.exe. Older versions of IIS may use aspnet_wp.exe instead.

ScottS