Microsoft KB Archive/318041

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

Article ID: 318041

Article Last Modified on 3/29/2007

-

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

-



This article was previously published under Q318041





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:  Use the local computer to build a Web solution on the remote computer, and then debug it. To do this, follow these steps:  Click Start, point to All Programs, and then point to Microsoft Visual Studio .NET or Microsoft Visual Studio 2005. Click Microsoft Visual Studio .NET or Microsoft Visual Studio 2005.  On the File menu, point to New and then click Project. In the New Project dialog box, click Visual Basic Projects under Project Types.

Note In Visual Studio 2005, click Visual Basic under Project Types. Under Templates, click ASP.NET Web Application.</li> 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.</li> Open WebForm1.aspx in the designer.</li> Double-click the designer to open the Code Editor window.

You are in the Page_Load event.</li>  Add the following code line to Page_Load: Response.Write(&quot;This is a test&quot;) </li> While you are on this line, press F9 to set a breakpoint.</li></ol>

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

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


 * 1) Region &quot; Web Form Designer Generated Code &quot;

'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


 * 1) End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Response.Write(&quot;This is a test&quot;) 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.

<div class="references_section">