Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

How to debug on computers that are running Windows XP and that are in the same Workgroup in Visual Studio .NET or in Visual Studio 2005


View products that this article applies to.

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.

Requirements

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

Create 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:
  1. On the local computer, log on by using a user account that has administrative permissions.
  2. On the local computer, right-click My Computer, and then click Manage.
  3. Create a new user account:
    1. Expand System Tools, expand Local Users and Groups, and then expand Users.
    2. Right-click Users.
    3. Click New User. The New User dialog box appears.
    4. 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.
    5. Click to clear the User cannot change password check box.
    6. Click to select the Password never expires check box.
    7. Click Create.
  4. Add the new user account to the Debugger Users group:
    1. Expand System Tools, expand Local Users and Groups, and then expand Groups.
    2. Double-click Debugger Users.
    3. In the Debugger Users Properties dialog box, click Add.
    4. 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.
    5. Click OK two times.
  5. Add the new user account to the Administrators group:
    1. Click Groups, and then double-click Administrators.
    2. In the Administrators Properties dialog box, click Add.
    3. 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.
    4. Click OK two times.
  6. Close the Computer Management tool.
  7. Repeat the steps 1 through 6 on the remote computer.

Change the default security setting

On both computers, you must change the default security setting. To do this, follow these steps:
  1. Click Start, and then click Control Panel.
  2. In Classic view, double-click Administrative Tools.
  3. Double-click Local Security Policy.
  4. Expand Local Policies. The Local Security Settings window appears.
  5. Under Local Policies, click Security Options.
  6. Double-click Network access: Sharing and security model for local accounts.
  7. In the drop-down list, click Classic - local users authenticate as themselves, and then click OK.
  8. Close Local Security Settings and Administrative Tools, and then restart the computer.

Change 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:
  1. Log on to the local computer by using the new user account.
  2. Click Start, and then click Control Panel.
  3. Double-click Internet Options. The Internet Properties dialog box appears.
  4. In the Internet Properties dialog box, click the Security tab.
  5. On the Security tab, click Internet.
  6. Click Custom Level. The Security Settings dialog box appears.
  7. 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?
  8. Click Yes, and then click OK.

Create a remote Web application

Use the local computer to create a Web application project on the remote computer. To do this, follow these steps:
  1. Start Visual Studio .NET or Visual Studio 2005.
  2. On the File menu, point to New, and then click Project.
  3. Under Project Types, click Visual Basic Projects.

    Note in Visual Studio 2005, click Visual Basic.
  4. Under Templates, click ASP.NET Web Application.

    Note In Visual Studio 2005, click ASP.NET Web Site.
  5. 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.
  6. On the Project menu, click Add Reference.
  7. Open WebForm1.aspx in the designer.
  8. Double-click the designer to open the code editor window.
  9. Add the following code in the Page_Load event.
    Response.Write("Hello World")
  10. At this line of code, press F9 on your keyboard to set a breakpoint at this line.

Verify 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.

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.

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="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


References

For more information, visit the following Microsoft Developer Network (MSDN) Web sites:

↑ Back to the top


Keywords: kbvs2005swept, kbvs2005applies, kbdebug, kbremoteprog, kbhowtomaster, KB833900

↑ Back to the top

Article Info
Article ID : 833900
Revision : 6
Created on : 4/29/2007
Published on : 4/29/2007
Exists online : False
Views : 451