views:

1086

answers:

4

I know I can start a process in code with Process.Start(). Is it also possible to attach the debugger to that process?

Not from code per se , but just a way to do it?

+3  A: 

In visual studio click Tools | Attach to process. Then select appropriate service.

dove
+2  A: 

You can do this in pretty much any debugger worth its salt.

Visual Studio has one that should fit your needs.

If you need a little more advanced control, try OllyDbg, which is a disassembler, so you can actually manipulate your program at the assembly level. This will give you complete control, but it might be information overload as well.

samoz
+5  A: 

You can attach to a running process using Tools | Attach to Process. If it's a Web Application, you can attach to it by attaching to aspnet_wp.exe.

To answer your question on how to attach to a process programmatically:

Here are other Stack Overflow questions that deal with that:

George Stocker
Is it also possible in code?
Bertvan
I updated my answer with other resources.
George Stocker
i got the answer in there first but hats off and +1, you've given much a worthier answer.
dove
@dove : I upvoted your answer. I liked your answer. I just answered and expounded it.
George Stocker
see also http://msdn.microsoft.com/en-us/library/c6wf8e4z.aspx
rohancragg
A: 

I want to start a process with Process.Start(), which is a web page. But I can not find aspnet_wp.exe under Tools. What is the problem?