Microsoft KB Archive/833900

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

Article ID: 833900

Article Last Modified on 4/29/2007

-

APPLIES TO


 * Microsoft Visual Studio 2005 Professional Edition
 * Microsoft Visual Studio 2005 Standard 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.1
 * Microsoft ASP.NET 1.0

-



IN THIS TASK

 * SUMMARY
 * Requirements
 * Create a new user account and add it to the appropriate groups for remote debugging
 * Change the default security setting
 * Change the Internet Explorer Logon setting
 * Create a remote Web application
 * Verify that remote debugging works
 * Troubleshooting
 * Complete code listing
 * REFERENCES



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 top

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

back to the top

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:  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: <ul> User name</li> Full name</li> Description</li> Password</li> Confirm password</li></ul>

Note You must create a user account that has the same password on both the local computer and the remote computer.</li> Click to clear the User cannot change password check box.</li> Click to select the Password never expires check box.</li> Click Create.</li></ol> </li> Add the new user account to the Debugger Users group: <ol style="list-style-type: lower-alpha;"> Expand System Tools, expand Local Users and Groups, and then expand Groups.</li> Double-click Debugger Users.</li> In the Debugger Users Properties dialog box, click Add.</li> 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 .</li> Click OK two times.</li></ol> </li> Add the new user account to the Administrators group: <ol style="list-style-type: lower-alpha;"> Click Groups, and then double-click Administrators.</li> <li>In the Administrators Properties dialog box, click Add.</li> <li>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 .</li> <li>Click OK two times.</li></ol> </li> <li>Close the Computer Management tool.</li> <li>Repeat the steps 1 through 6 on the remote computer.</li></ol>

back to the top

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.

back to the top

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: <ol> <li>Log on to the local computer by using the new user account.</li> <li>Click Start, and then click Control Panel.</li> <li>Double-click Internet Options. The Internet Properties dialog box appears.</li> <li>In the Internet Properties dialog box, click the Security tab.</li> <li>On the Security tab, click Internet.</li> <li>Click Custom Level. The Security Settings dialog box appears.</li> <li>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?

</li> <li>Click Yes, and then click OK.</li></ol>

back to the top

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: <ol> <li>Start Visual Studio .NET or Visual Studio 2005.</li> <li>On the File menu, point to New, and then click Project.</li> <li>Under Project Types, click Visual Basic Projects.

Note in Visual Studio 2005, click Visual Basic.</li> <li>Under Templates, click ASP.NET Web Application.

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

back to the top

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.

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 top

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;WebApplication1.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.1&quot;> <meta name=&quot;CODE_LANGUAGE&quot; content=&quot;Visual Basic .NET 7.1&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;> </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;

'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


 * 1) 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(&quot;Hello World&quot;) End Sub

End Class back to the top

<div class="references_section">