SUMMARY
This step-by-step article describes how to set up remote
debugging in Microsoft Visual Studio .NET or in Microsoft Visual Studio 2005 between two computers that are running Microsoft Windows XP Professional. In this scenario, the two computers are not on the same domain. However, they are in the same Workgroup.
back to
the topRequirements
This article assumes that you are
familiar with the following topics:
- Microsoft Windows XP Professional with the Microsoft .NET Framework
installed
- Microsoft Visual Studio .NET or Microsoft Visual Studio 2005
The following list outlines the recommended hardware, software,
network infrastructure, and service packs that you need:
- Visual Studio .NET or Visual Studio 2005
- Debugging
back to the topCreate a new user account and add it to the appropriate groups for remote debugging
To use remote debugging, you must add the appropriate user account to
the Debugger Users group and the Administrators group on the remote computer
and on the local computer. To do this, follow these steps:
- On the local
computer, log on by using a user account that has administrative permissions.
- On the local computer, right-click
My Computer, and then click
Manage.
- Create a new user account:
- Expand
System Tools, expand Local Users and Groups,
and then expand Users.
- Right-click Users.
- Click New User. The New User dialog box appears.
- In the following text boxes, type the information that you want to use for the new user account:
- User name
- Full
name
- Description
- Password
- Confirm password
Note You must create a user
account that has the same password on both the local computer and the remote computer. - Click to clear the User cannot change
password check box.
- Click to select the Password never
expires check box.
- Click Create.
- Add the new user account to the Debugger Users group:
- Expand
System Tools, expand Local Users and Groups,
and then expand Groups.
- Double-click Debugger Users.
- In the Debugger Users Properties dialog
box, click
Add.
- In the Select Users dialog box, type the
appropriate user account in the Enter the object
names to select field. For example, type Domain1\User1.
- Click OK two
times.
- Add the new user account to the Administrators group:
- Click
Groups, and then double-click Administrators.
- In the Administrators Properties dialog
box, click
Add.
- In the Select Users dialog box, type the
appropriate user account in the Enter the object
names to select field. For example, type Domain1\User1.
- Click OK two
times.
- Close the Computer Management tool.
- Repeat the steps 1 through 6 on the remote computer.
back to the topChange the default
security setting
On both computers, you must change the default security
setting. To do this, follow these steps:
- Click Start, and then click Control
Panel.
- In Classic view, double-click Administrative
Tools.
- Double-click
Local Security Policy.
- Expand Local Policies. The Local Security Settings window appears.
- Under
Local Policies, click Security Options.
- Double-click Network access: Sharing and security
model for local accounts.
- In the drop-down list, click Classic - local users
authenticate as themselves, and then click OK.
- Close Local Security Settings and Administrative Tools, and then restart the computer.
back to the topChange the Internet Explorer Logon setting
When you create a Web project by using the full computer name,
Microsoft Internet Explorer recognizes the Web site as an Internet site. When you log on to the computer by using the new user account, Internet
Explorer uses the default security settings of the Internet zone. By default, the
Logon setting is
Automatic logon only in Intranet zone.
To perform remote debugging by using the new user account that you created earlier, you must change the
Logon setting to permit you to log on automatically by using the new user account. To do this, follow these steps:
- Log on to the local computer by using the new user account.
- Click Start, and then click Control
Panel.
- Double-click Internet Options. The Internet Properties dialog box
appears.
- In the Internet Properties dialog box, click the
Security tab.
- On the Security tab, click
Internet.
- Click Custom Level. The Security Settings dialog box appears.
- Under User Authentication, click to select the Automatic logon with
current username and password option, and then click OK. The following warning message appears: Are you sure you want to change the security settings for this
zone?
- Click Yes, and then click OK.
back to the topCreate a remote Web application
Use the local computer to create a Web application project on the
remote computer. To do this, follow these steps:
- Start Visual Studio .NET or Visual Studio 2005.
- On the File menu, point to
New, and then click Project.
- Under Project
Types, click
Visual Basic Projects.
Note in Visual Studio 2005, click Visual Basic. - Under Templates, click ASP.NET Web
Application.
Note In Visual Studio 2005, click ASP.NET Web
Site. - In the
Location box, type a URL that is located on the remote computer. For example, type http://RemoteComputer/WebApp, and then click OK.
Visual Studio .NET creates the solution.
- On the Project menu, click Add
Reference.
- Open WebForm1.aspx in the
designer.
- Double-click the designer to open the code editor
window.
- Add the following code in the Page_Load event.
Response.Write("Hello World")
- At this line of code, press F9 on
your keyboard to set a breakpoint at this line.
back to the topVerify that remote debugging works
To verify that remote debugging works, click
Start on
the
Debug menu. The application runs in debug mode and stops at the breakpoint that you set earlier.
back to the top Troubleshooting
If you experience problems when you debug your remote Web application, verify the following:
- The Web.config file for the ASP.NET Web application does not
contain any errors, and the compilation element has a debug attribute
that is set to True.
- The security setting for the site permits Integrated
Windows authentication.
- In the Properties window of the project, you have turned on
ASP.NET Debugging. This option is located under Debugging in
Configuration Properties.
back to the
topComplete code listing
WebForm1.aspx
The following is the complete code listing for Webform1.aspx.
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="WebApplication1.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.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<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">
</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 "
'The Web Form Designer requires this call.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
'NOTE: The Web Form Designer requires the following placeholder.
'Do not delete it or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: The Web Form Designer requires this method call.
'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
'Put user code to initialize the page here.
Response.Write("Hello World")
End Sub
End Class
back to the top