VS 2003 Tip #14: What are the requirements to debug a managed application?
Every now and then we get a question about debugging managed code with Visual Studio. It is a little confusing so I thought I'd shed some light on it in this post. A canonical example to use here is where you have a web server on some remote machine running ASP.NET code. Something goes wrong on it and you want to debug it.
To debug using Visual Studio 2003, you need to put remote debugging components on the web server. Insert the main VS disc and on the screen that says 1,2,3- at the bottom is a link for remote component install. Click that and install the managed remote debugging components.
Now when you go to attach to the aspnet_wp.exe process on the remote machine to managed debug it, there are two things that need to happen before you can do so.
The first: Visual Studio uses a service to do debugging called the MDM or Machine Debug Manager. This is one of the components installed by the remote debugging components. This is needed only by Visual Studio - so if you have the framework on your machine, or cordbg you this doesnt apply. The MDM is the first gatekeeper - only two people are allowed to talk to it. Admins on the machine + members of the Debugger Users group (a group created on the machine when the mdm installs). The Debugger Users group is often misunderstood. It serves one function only - its members are allowed access to the MDM. It gives no other permission or privelige to you.
So lets say you add yourself to the Debugger users group and you are'nt an admin on the machine. Now comes the second test - the runtime rule for managed debugging. The rule is simple - if the managed process is running as you, or you are an admin on the machine, you can managed debug it. So now the debugger tries to attached to aspnet_wp.exe (which almost always runs as ASPNET user). You are'nt an admin so that check fails. You arent ASPNET so that check fails too and you cant attach. The trick is to get Admin on the machine, or change the config file for aspnet_wp.exe to run as you. Both have security implications so be careful when you do this.
I hope that helps you better understand what it takes to managed debug an application. For other remote ASP.NET debugging pains, Min keeps an excellent troubleshooting document at https://weblogs.asp.net/mkpark/articles/86872.aspx
Comments
- Anonymous
April 14, 2004
The comment has been removed - Anonymous
April 15, 2004
The comment has been removed - Anonymous
April 21, 2004
How do I remove Remote Debugger? I am having problems and get the message "Error while trying to run project: Unable to start debugging on the Web server. You do not have permission to debut the application. The URL for this project is in the internet zone."
I accidently installed Remote Debugger and I think that it is causing part of the problem.
Thanks for any help,
Jacque - Anonymous
May 17, 2004
Shaykat,
Are there any plans to allow Remote Debugging when the user is just a member of the Debug Users group and while the process is still executing as ASPNET?
Dave - Anonymous
May 26, 2009
PingBack from http://backyardshed.info/story.php?title=shaykatc-s-weblog-vs-2003-tip-14-what-are-the-requirements-to-debug