How to set up and use remote debugging in Visual Studio .NET or in Visual Studio 2005

Article translations Article translations
Article ID: 318041 - View products that this article applies to.
This article was previously published under Q318041
Expand all | Collapse all

On This Page

SUMMARY

This step-by-step article describes how to set up and use remote debugging in Microsoft Visual Studio .NET or in Microsoft Visual Studio 2005.

Requirements

The following list outlines the recommended hardware, software, network infrastructure, and service packs that are required:
  • Microsoft Windows XP Professional with the .NET Framework installed.
  • Microsoft Visual Studio .NET or Microsoft Visual Studio 2005.
This article assumes that you are familiar with the following topics:
  • Visual Studio .NET or Visual Studio 2005
  • Debugging

Set up remote debugging

To use remote debugging, you must add the appropriate user to the Debugger Users group on the remote computer. To do this, follow these steps:
  1. On the remote computer, right-click My Computer, and then click Manage.
  2. In the Computer Management list, expand System Tools, expand Local Users and Groups, and then expand Groups.
  3. Double-click Debugger Users.
  4. To add the appropriate user to the Debugger Users group, click Add in the Debugger Users Properties dialog box.
  5. In the Select Users, Computers, or Groups dialog box, enter the appropriate user (for example Domain1\User1) in the Enter the object names to select field, and then click OK two times.
  6. Close the Computer Management tool.
To set up and test remote debugging, follow these steps:
  1. Use the local computer to build a Web solution on the remote computer, and then debug it. To do this, follow these steps:
    1. Click Start, point to All Programs, and then point to Microsoft Visual Studio .NET or Microsoft Visual Studio 2005.
    2. Click Microsoft Visual Studio .NET or Microsoft Visual Studio 2005.
  2. On the File menu, point to New and then click Project.
  3. In the New Project dialog box, click Visual Basic Projects under Project Types.

    Note In Visual Studio 2005, click Visual Basic under Project Types.
  4. Under Templates, click ASP.NET Web Application.
  5. Enter a URL on the remote server for the location (for example, http://RemoteServer/WebApp).

    Visual Studio .NET or Visual Studio 2005 creates the solution.
  6. Open WebForm1.aspx in the designer.
  7. Double-click the designer to open the Code Editor window.

    You are in the Page_Load event.
  8. Add the following code line to Page_Load:
    Response.Write("This is a test")
  9. While you are on this line, press F9 to set a breakpoint.

Complete code listing

WebForm1.aspx

The following is the complete code listing for Webform1.aspx:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="WebApp.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
   <HEAD>
	<title>WebForm1</title>
	<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.0">
	<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
	<meta name="vs_defaultClientScript" content="JavaScript">
	<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
   </HEAD>
<body MS_POSITIONING="GridLayout">
	<form id="Form1" method="post" runat="server">
	<font face="MS UI Gothic"></font>
	</form>
	</body>
</HTML>

WebForm1.aspx.vb

The following is the complete code listing for WebFOrm1.aspx.vb:
Public Class WebForm1
    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer.
        'Do not modify it by using the Code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Response.Write("This is a test")
    End Sub

End Class

Verify that remote debugging works

To verify that remote debugging works, press F5 to run the application in debug mode.

Execution stops at the breakpoint.

Troubleshooting

  • When you enter the user in the Debugger Users group, both the remote computer and the local computer must be part of a domain. You cannot enable remote debugging on two computers that are running Windows XP and that are part of a workgroup instead of a domain.
  • The Web.config file for the ASP.NET application must not contain any errors, and the compilation element must have a debug attribute that is set to True.
  • As a minimum, the Visual Studio .NET or Visual Studio 2005 remote debugging components must be installed on the remote computer.
  • The security setting for the site must allow Integrated Windows authentication.

    The site may also allow anonymous access.
  • You must reference the remote computer by using a computer name instead of an IP address.

REFERENCES

For more information, visit the following MSDN article:
Debugging in Visual Studio .NET
http://msdn2.microsoft.com/en-us/library/aa290350(VS.71).aspx

Properties

Article ID: 318041 - Last Review: March 29, 2007 - Revision: 5.4
APPLIES TO
  • Microsoft Visual Studio 2005 Standard Edition
  • Microsoft Visual Studio 2005 Professional Edition
  • Microsoft Visual Studio .NET 2003 Professional Edition
  • Microsoft Visual Studio .NET 2003 Enterprise Architect
  • Microsoft Visual Studio .NET 2003 Enterprise Developer
  • Microsoft Visual Studio .NET 2003 Academic Edition
  • Microsoft Visual Studio .NET 2002 Professional Edition
  • Microsoft Visual Studio .NET 2002 Enterprise Architect
  • Microsoft Visual Studio .NET 2002 Enterprise Developer
  • Microsoft Visual Studio .NET 2002 Academic Edition
  • Microsoft ASP.NET 1.0
  • Microsoft ASP.NET 1.1
Keywords: 
kbvs2005swept kbvs2005applies kbhowtomaster KB318041

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com