0 out of 2 rated this helpful - Rate this topic

Setting Up Network Debugging in Visual Studio

Debugging Tools for Windows supports kernel-mode debugging over an Ethernet network. Ethernet debugging is supported beginning in Windows 8. Network debugging in Visual Studio has the following advantages compared to debugging over other types of cable:

  • The host and target computers can be anywhere on the local network.
  • It is easy to debug many target computers from one host computer.
  • Network cable is inexpensive and readily available.
  • Given any two computers, it is likely that they will both have Ethernet adapters. It is less likely that they will both have serial ports or both have 1394 ports.

The computer that runs the debugger is called the host computer, and the computer that is being debugged is called the target computer. The host computer must be running Windows XP or later, and the target computer must be running Windows 8 or Windows Server 2012.

Supported network adapters

The host computer can use any wired or wireless network adapter, but the target computer must use a network adapter that is supported by Debugging Tools for Windows. For a list of supported network adapters, see Network Adapters Supported for Debugging.

Configuring the target computer

On the target computer, go to Control Panel > Network and Internet > Network and Sharing Center > Change advanced sharing settings. Under Guest or Public, select Turn on network discovery and Turn on file and printer sharing.

Connect the network adapter of the target computer to a network hub or switch using standard CAT5 (or higher-level) network cable. Do not use a crossover cable, and do not use a crossover port in your hub or switch. Connect the network adapter of the host computer to a network hub or switch using a standard cable or a wireless connection.

You can finish the configuration from the host computer:

  1. On the host computer, in Microsoft Visual Studio, on the Driver menu, choose Test > Configure Computers.
  2. Click Add new computer. The Computer Configuration dialog box opens.
  3. For Computer name, enter the name of the target computer.
  4. You have the following three configuration options as shown here.

    Screenshot of Computer Configuration dialog box showing three provisioning options: 1) Provision computer and automatically configure debuggers, 2) Provision computer and choose debugger settings, or 3) Manually configure debuggers and do not provision

    The first two options configure the target computer for automatic driver deployment, automatic driver testing, and debugging. Configuring the target computer for automatic deployment and testing is called provisioning the target computer. For more information, see Configuring a Computer for Testing and Debugging. The third option configures the target computer for debugging but does not provision the target computer.

    Note  The first option creates a port number for network debugging and does not give you the opportunity to change the port number. If your company has restrictions on which port numbers can be used for network debugging, select the second option, Provision computer and choose debugger settings.

    If you want to configure the target computer for debugging, but do not want to provision the target computer for testing and automatic driver deployment, select the third option, Manually configure debuggers and do not provision.

    Click Next.

  5. If you selected the second or third option in the previous step, you have an opportunity to configure the debugging settings.

    Screen shot showing an example of debugger settings with values for the following fields: Connection Type, Port Number, Key, Host IP, and Bus Parameters

    For Port Number, accept the default value or fill in a value of your choice. You can choose any number from 49152 through 65535. The port that you choose will be opened for exclusive access by the debugger running on the host computer. Take care to choose a port number that is not used by any other applications that run on the host computer. For Key, we strongly recommend that you use the automatically generated default value. However, you can enter your own key if you prefer. For more information, see Creating your own key later in this topic. For Host IP, accept the default value. This is the IP address of your host computer.

    If your target computer has only one network adapter, you can leave Bus Parameters empty. If there is more than one network adapter in the target computer, use Device Manager on the target computer to determine the PCI bus, device, and function numbers for the adapter you want to use for debugging. For Bus Parameters, enter b.d.f where b, d, and f are the bus number, device number, and function number of the adapter.

    Click Next.

  6. The configuration process takes several minutes and might automatically reboot the target computer once or twice. When the process is complete, click Finish.

Caution  If your target computer is in a docking station, and you have network debugging enabled for a network adapter that is part of the docking station, do not remove the computer from the docking station. If you need to remove the target computer from the docking station, disable kernel debugging first. To disable kernel debugging on the target computer, open a Command Prompt window as Administrator and enter the command bcdedit /debug off. Reboot the target computer.

Note  As an alternative to configuring the target computer from Visual Studio on the host computer, you can configure the target computer manually, as described in Setting Up a Network Debugging Connection Manually.

Note  If you intend to install the Hyper-V role on the target computer, see Setting Up Network Debugging of a Virtual Machine Host.

Starting the Debugging Session

  1. On the host computer, in Visual Studio, on the Tools menu, choose Attach to Process.
  2. For Transport, choose Windows Kernel Mode Debugger.
  3. For Qualifier, select the name of the target computer that you previously configured.
  4. Click Attach.

Creating Your Own Key

To keep the target computer secure, packets that travel between the host and target computers must be encrypted. We strongly recommend that you use an automatically generated encryption key (provided by the Visual Studio configuration wizard) when you configure the target computer). However, you can choose to create your own key. Network debugging uses a 256-bit key that is specified as four 64-bit values, in base 36, separated by periods. Each 64-bit value is specified by using up to 13 characters. Valid characters are the letters a through z and the digits 0 through 9. Special characters are not allowed. The following list gives examples of valid (although not strong) keys:

  • 1.2.3.4
  • abc.123.def.456
  • dont.use.previous.keys

Troubleshooting Tips for Debugging over a Network Cable

Debugging application must be allowed through firewall

When you first attempt to establish a network debugging connection, you might be prompted to allow the debugging application (Microsoft Visual Studio) through the firewall. Respond to the prompt by checking the boxes for all three network types: domain, private, and public. If you don't check those boxes the first time you see the prompt, you probably will not see the prompt again. In that case, you can use Control Panel to allow access through the firewall. Open Control Panel > System and Security, and click Allow an app through Windows Firewall. In the list of applications, use the check boxes to allow Visual Studio through the firewall. Restart Visual Studio.

Port number must be in range allowed by network policy

The range of port numbers that can be used for network debugging might be limited by your company's network policy. To determine whether your company's policy limits the range of ports that can be used for network debugging, check with your network administrator.

Use the following procedure if you need to change the port number.

  1. On the host computer, in Visual Studio, on the Driver menu, choose Test > Configure Computers.
  2. Select the name of your test computer, and click Next.
  3. Select Provision computer and choose debugger settings. Click Next.
  4. For Port Number, enter a number that is in the range allowed by your network administrator. Click Next.
  5. The reconfiguration process takes a few minutes and automatically reboots the target computer. When the process is complete, click Next and Finish.

Specify busparams if target computer has multiple network adapters

If your target computer has more than one network adapter, you must specify the bus, device, and function numbers of the network adapter that you intend to use for debugging. To specify the bus parameters, open Device Manager, and locate the network adapter that you want to use for debugging. Open the property page for the network adapter, and make a note of the bus number, device number, and function number. In an elevated Command Prompt Window, enter the following command, where b, d, and f are the bus, device and function numbers in decimal format:

bcdedit -set {dbgsettings} busparams b.d.f

Reboot the target computer.

 

 

Send comments about this topic to Microsoft

Build date: 4/9/2013

© 2013 Microsoft. All rights reserved.