Microsoft KB Archive/908099

= How to turn on remote debugging for Visual Studio 2005 in Windows XP with Service Pack 2 =

Article ID: 908099

Article Last Modified on 1/22/2007

-

APPLIES TO


 * Microsoft Visual Studio 2005 Standard Edition
 * Microsoft Visual Studio 2005 Professional Edition
 * Microsoft Visual Studio 2005 Express Edition

-





Notice
Microsoft now provides a tool that will do most of the required firewall configuration for you. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

841177 Description of the DebuggerFirewall utility that makes the Visual Studio Remote Debugger work through the Windows XP Service Pack 2 firewall



Important This article contains information about how to modify the registry. Make sure to back up the registry before you modify it. Make sure that you know how to restore the registry if a problem occurs. For more information about how to back up, restore, and modify the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows registry



SUMMARY
''This article discusses how to turn on remote debugging for Microsoft Visual Studio 2005 in Microsoft Windows XP with Service Pack 2 (SP2). Windows Firewall replaces the Internet Connection Firewall (ICF) feature that is included in earlier versions of Windows XP.

To turn on remote debugging for Visual Studio 2005, you may have to change the configuration of Windows Firewall. You may also have to open ports, configure DCOM settings, turn on file and print sharing, and add applications to the exceptions list on both the computer that is running Visual Studio 2005 and the remote computer.''



INTRODUCTION
The Windows Firewall feature in Windows XP SP2 includes significant enhancements over the earlier the Internet Connection Firewall (ICF) feature. These enhancements help protect the computer from attack by malicious users or by malicious software such as viruses. By default, Windows Firewall is turned on for all network connections including connections to the Internet.

Turn on remote debugging
To turn on remote debugging in Windows XP with SP2, you must configure Windows Firewall as follows:
 * If Windows Firewall is in &quot;shielded&quot; mode, you must perform the appropriate actions so that Windows Firewall is no longer in &quot;shielded&quot; mode.
 * If Windows Firewall is on, you must open some ports. You must also grant some permissions to Microsoft Visual Studio 2005 and to other executable programs that are used in remote debugging.
 * If Windows Firewall is off, you may not have to configure a firewall.
 * Additionally, if the user who runs Microsoft Visual Studio 2005 does not have Administrator user rights on the remote computer, you must configure the DCOM settings on the computer that is running Visual Studio 2005.

To turn on remote debugging, you must have Administrator user rights on the computer that is running Visual Studio 2005. These instructions are only for Internet Protocol version 4 (IPV4) based network settings.

Configure DCOM on the computer that is running Visual Studio 2005
Note After you make changes by using the DCOM Configuration tool (Dcomcnfg.exe), you must restart the computer for the changes to take effect.
 * 1) At a command prompt, type dcomcnfg, and then press ENTER. Component Services opens.
 * 2) In Component Services, expand Component Services, expand Computers, and then expand My Computer.
 * 3) On the toolbar, click Configure My Computer. The My Computer dialog box appears.

Note If you cannot click Configure My Computer, go to the &quot;Remove and then re-install the MSDTC service&quot; section.
 * 1) In the My Computer dialog box, click the COM Security tab.
 * 2) Under Access Permission, click Edit Limits. The Access Permission dialog box appears.
 * 3) Under Group or user names, click ANONYMOUS LOGON.
 * 4) Under Permissions for ANONYMOUS LOGON, click to select the Remote Access check box, and then click OK.

Remove and then re-install the MSDTC service
If you cannot click Configure My Computer that is described in step 3 in the &quot;Configure DCOM on the computer that is running Visual Studio 2005&quot; section, follow these steps.

Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall your operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.  Remove the Microsoft Distributed Transaction Service (MSDTC):  Click Start, click Run, type cmd, and then click OK. At the command prompt, run the following command to stop the MSDTC service:

Net stop msdtc

 At the command prompt, run the following command to remove the MSDTC service:

Msdtc –uninstall

The command prompt will return without a message.  In Registry Editor, delete the  subkey.</li> Re-install and then start the MSDTC service:  At the command prompt, run the following command to re-install the MSDTC service:

Msdtc –install

</li> At the command prompt, run the following command to start the MSDTC service:

Net start msdtc

</li></ol> </li> Go to step 4 in the &quot;Configure DCOM on the computer that is running Visual Studio 2005&quot; section.</li></ol>

Open Windows Firewall
To open Windows Firewall, click Start, click Run, type firewall.cpl, and then click OK.

Open TCP port 135
DCOM remote procedure call (RPC) uses Transfer Control Protocol (TCP) port 135. If the application uses DCOM to communicate with remote computers, port 135 must be open.

To open TCP port 135, follow these steps:
 * 1) In Windows Firewall, click Add Port on the Exceptions tab. The Add a Port dialog box appears.
 * 2) In the Name box, type TCP port 135.
 * 3) In the Port Number box, type 135.
 * 4) In the Protocol area, click TCP.
 * 5) Click Change scope to open Change Scope dialog box, click My network (subnet) only, and then click OK. (This step is optional.)
 * 6) In the Add a Port dialog box, click OK.

Open UDP port 4500
User Datagram Protocol (UDP) port 4500 is used for Internet Protocol security (IPsec). If your domain policy requires that all network communication be completed through IPsec, this port must be open for any network operation. If your domain policy does not require IPsec, go to the &quot;Turn on file and print sharing&quot; section.

To open UDP port 4500, follow these steps:
 * 1) In Windows Firewall, click Add Port on the Exceptions tab. The Add a Port dialog box appears.
 * 2) In the Name box, type UDP port 4500.
 * 3) In the Port Number box, type 4500.
 * 4) In the Protocol area, click UDP.
 * 5) Click Change scope. The Change Scope dialog box appears. Click My network (subnet) only, and then click OK. (This step is optional.)
 * 6) In the Add a Port dialog box, click OK.

Open UDP port 500
UDP port 500 is used for IPsec. If your domain policy requires that all network communication be completed through IPsec, this port must be open for any network operation. If your domain policy does not require IPsec, go to the &quot;Turn on file and print sharing&quot; section.

To open UDP port 500, follow these steps:
 * 1) In Windows Firewall, click Add Port on the Exceptions tab. The Add a Port dialog box appears.
 * 2) In the Name box, type UDP port 500.
 * 3) In the Port Number box, type 500.
 * 4) In the Protocol area, click UDP.
 * 5) Click Change scope. The Change Scope dialog box appears. Click My network (subnet) only, and then click OK. (This step is optional.)
 * 6) In the Add a Port dialog box, click OK.

Turn on file and print sharing

 * 1) In the Programs and Services area of the Exceptions tab, click File and Print Sharing, and then click Edit. The Edit a Service dialog box appears.
 * 2) In the Edit a Service dialog box, click to select the following check boxes:
 * 3) * TCP 139
 * 4) * TCP 445
 * 5) * UDP 137
 * 6) * UDP 138
 * 7) Click Change scope. The Change Scope dialog box appears. Click My network (subnet) only, and then click OK. (This step is optional.)
 * 8) In the Change Scope dialog box, click OK to save your settings.
 * 9) Click OK to close the Edit a Service dialog box.

Add Devenv.exe to the application exceptions list
To enable applications that cannot run correctly unless the required ports are opened dynamically at runtime, you must add the applications to the application exceptions list.

To add the Visual Studio 2005 Development Environment (Devenv.exe) to the application exceptions list, follow these steps:  In Windows Firewall, click Add Program on the Exceptions tab. The Add a Program dialog box appears.</li> In the Add a Program dialog box, click Browse. Locate Devenv.exe, and then click OK.

Note The Devenv.exe file is typically located in the following folder:

C:\Program Files\Microsoft Visual Studio 8\Common7\IDE

Microsoft Visual Studio 2005 appears in the Add a Program dialog box.</li> Click Change scope. The Change Scope dialog box appears. Click My network (subnet) only, and then click OK. (This step is optional.)</li> In the Add a Program dialog box, click OK.</li> In Windows Firewall, click OK to save your settings.</li></ol>

Configure the remote computer
All the ports that you have opened on the debugger computer must also be open on the remote computer. To open the TCP 135 port, the UDP 4500 port, and the UDP 500 port, and to turn on file and print sharing, follow the steps in the &quot;Configure the computer that is running Visual Studio 2005&quot; section.

You must also add the Msvsmon.exe file to the application exceptions list.

Add MSVSMon.exe to the application exceptions list
 In Windows Firewall, click Add Program on the Exceptions tab. The Add a Program dialog box appears.</li> In the Add a Program dialog box, click Browse. Locate Msvsmon.exe, and then click OK.

Note Depending on the computer architecture, the Msvsmon.exe file may be located in any one of the following folders: <ul>  :\Program Files\Microsoft Visual Studio 8\Common7\IDE\Remote Debugger\x86</li> <li> :\Program Files\Microsoft Visual Studio 8\Common7\IDE\Remote Debugger\x64</li> <li> :\Program Files\Microsoft Visual Studio 8\Common7\IDE\Remote Debugger\ia64</li></ul>

Visual Studio 2005 Remote Debugger appears in the Add a Program dialog box.</li> <li>Click Change scope. The Change Scope dialog box appears. Click My network (subnet) only, and then click OK. (This step is optional.)</li> <li>In the Add a Program dialog box, click OK.</li> <li>In Windows Firewall, click OK to save your settings.</li></ol>

Enable Web server debugging
HTTP uses TCP port 80. To do Web-based debugging, you must open TCP port 80. This is true for Microsoft ASP.NET debugging, for classic ASP debugging, and for ATL Server debugging.

To open TCP port 80, follow these steps:
 * 1) In Windows Firewall, click Add Port on the Exceptions tab. The Add a Port dialog box appears.
 * 2) In the Name box, type TCP port 80.
 * 3) In the Port Number box, type 80.
 * 4) In the Protocol area, click TCP.
 * 5) Click Change scope. The Change Scope dialog box appears. Click My network (subnet) only, and then click OK. (This step is optional.)
 * 6) In the Add a Port dialog box, click OK.
 * 7) In Windows Firewall, click OK to save your settings.

Enable script debugging
To debug script code that runs on a remote computer, you must add the process that hosts the script code to the application exceptions list. Typically, in classic ASP debugging, the Dllhost.exe process or the Inetinfo.exe process hosts the script code. However, for a script that runs in Microsoft Internet Explorer, the Iexplore.exe process or in the Explorer.exe process generally hosts the script code.

To add the process that hosts the script code to the application exceptions list, follow these steps:
 * 1) Click Start, click Run, type firewall.cpl, and then click OK.
 * 2) In Windows Firewall, click Add Program on the Exceptions tab. The Add a Program dialog box appears.
 * 3) In the Add a Program dialog box, click Browse. Locate the process that hosts the script code, and then click OK. The application of the process that hosts the script code appears in the Add a Program dialog box.

For example, if you locate the iexplore.exe process in this step, Internet Explorer appears in the Add a Program dialog box.
 * 1) In the Scope area, click My network (subnet) only. (This step is optional.)
 * 2) In the Add a Program dialog box, click OK.
 * 3) In Windows Firewall, click OK to save your settings.

Run the debugger as a typical user
If you want to run the debugger as a typical user, you must have full user rights to the folder where the executable files are located. Additionally, if you do not have Administrator user rights on the remote computer, you must have access permissions and start permissions to run the debugger as a typical user.

Note A typical user is a user who does not have Administrator user rights.

Note After you make changes by using the DCOM Configuration tool (Dcomcnfg.exe), you must restart the computer for the changes to take effect.

To grant access permissions and start permissions, you must have Administrator user rights. First, obtain Administrator user rights. Then, follow these steps: <ol> <li>At a command prompt, type dcomcnfg, and then press ENTER. Component Services opens.</li> <li>In Component Services, expand Component Services, expand Computers, and then expand My Computer.</li> <li>On the toolbar, click Configure My Computer. The My Computer dialog box appears.

Note If you cannot click Configure My Computer, go to the &quot;Remove and then re-install the MSDTC service&quot; section.</li> <li> In the My Computer dialog box, click the COM Security tab.</li> <li>Under Launch and Activate Permissions, click Edit Limits.</li> <li>If your group or user name does not appear in the Groups or user names list in the Launch Permission dialog box, follow these steps: <ol style="list-style-type: lower-alpha;"> <li>In the Launch Permission dialog box, click Add.</li> <li>In the Select Users or Groups dialog box, enter your user name and your group in the Enter the object names to select box, and then click OK.</li></ol> </li> <li>In the Launch Permission dialog box, select your user name and your group in the Group or user names box.</li> <li>In the Allow column under Permissions for , select Remote Activation, and then click OK.

Note  is a placeholder for the user name or the group that is selected in the Group or user names box. Repeat steps 7 and 8 for all the users and groups for which you want to grant permissions.</li></ol>

Remove and then re-install the MSDTC service
If you cannot click Configure My Computer that is described in step 3 in the &quot;Run the debugger as a typical user&quot; section, follow these steps.

Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall your operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk. <ol> <li>Remove the MSDTC service: <ol style="list-style-type: lower-alpha;"> <li>Click Start, click Run, type cmd, and then click OK.</li> <li>At the command prompt, run the following command to stop the MSDTC service:

Net stop msdtc

</li> <li>At the command prompt, run the following command to remove the MSDTC service:

Msdtc –uninstall

The command prompt will return without a message.</li></ol> </li> <li>In Registry Editor, delete the  subkey.</li> <li>Re-install and then start the MSDTC service: <ol style="list-style-type: lower-alpha;"> <li>At the command prompt, run the following command to re-install the MSDTC service:

Msdtc –install

</li> <li>At the command prompt, run the following command to start the MSDTC service:

Net start msdtc

</li></ol> </li> <li>Go to step 4 in the &quot;Run the debugger as a typical user&quot; section.</li></ol>

<div class="moreinformation_section">

MORE INFORMATION
For more information about Windows Firewall, click the following article number to view the article in the Microsoft Knowledge Base:

843090 Description of the Windows Firewall feature in Windows XP Service Pack 2

For more information about Windows XP SP2, visit the following Microsoft Developer Network (MSDN) Web site:

http://msdn2.microsoft.com/en-us/security/aa570371.aspx

For more information about remote debugging, click the following article number to view the article in the Microsoft Knowledge Base:

833977 How to turn on remote debugging in Windows XP with Service Pack 2

Keywords: kbinfo kbtshoot kbhowtomaster KB908099

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.