Set Up an Environment to Perform Remote Debugging

First I’d like to introduce a new feature: I’ll provide the relevant MSDN links for each topic reviewed here at the end of each post, so you will be able to read more material. I’ll update the older posts constantly, so all links will be available I suppose in a week.

When we build an application, we spend a considerable amount of time with debugging, removing the flaws, logical errors, etc. to create something that seems perfect. Then we deploy our app on other machines as well, and start the whole debugging process over again. There are many errors or exception that won’t occur on our development machines, because we configured it well (or just forgot one or two assemblies to include). For solving these errors, we can use remote debugging.

The process is simple. First, we need to set up the remote computer to let us debug it from our local computer. Then, we need to attach to the process we want to debug, and lastly, we should debug. Let’s examine these steps:

Enable Remote Debugging

To enable remote debugging, we should use the Remote Debugging Monitor (Msvsmon.exe) which ships with Visual Studio. You should install and run it on the server you wish to debug. And you will need Administrative rights on the target server, to perform the task. The Remote Debugging Monitor deals with the setup of the environment. There could be cases when it won’t be able to do so. So you should configure a firewall port (135) manually, to enable remote debugging.

Attach To a Process

To attach to a process, use Visual Studio’s Attach to Process window. Set the Qualifier to the name of the server you intend to debug, and then select the process you wish to examine.

Issues with Remote Debugging

When you debug a running application, you should be aware of the users of it. For example, if you set a breakpoint in the code, all users will be halted at that point until you clear it.

Take into account that you will need the source code to debug something. When you attach to the remote process and don’t have the project opened in Visual Studio, it will ask you for the location of the source code.

Further Readings

How to: Set up Remote Debugging

How to: Debug Web Applications on a Remote Server

How to: Attach to a Running Process

Debugging Deployed Web Applications and Web Services

Microsoft .NET Framework 3.5-ASP.NET Application Development Training Kit pages: 753-755

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s