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:
- On the remote computer, right-click My
Computer, and then click Manage.
- In the Computer Management list, expand
System Tools, expand Local Users and Groups,
and then expand Groups.
- Double-click Debugger Users.
- To add the appropriate user to the Debugger Users group,
click Add in the Debugger Users Properties
dialog box.
- 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.
- 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.
- 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. - Open WebForm1.aspx in the
designer.
- Double-click the designer to open the Code Editor
window.
You are in the Page_Load event. - Add the following code line to Page_Load:
Response.Write("This is a test")
- 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.