XAML Spy 3 | XAML Spy 2
Describing how to configure and use the remote debugging feature of XAML Spy.
XAML Spy is able to spy on apps that run on remote devices. This feature is required for a number of scenarios;
Most Windows apps do not require remote debugging. Silverlight, WPF, and UWP apps running on the same machine where XAML Spy is installed, will connect using localhost.
For remote debugging to work, remote apps need to be able to open a TCP connection to the machine running the XAML Spy Service. First of all XAML Spy needs to be configured to allow remote apps to connect. Next to that the firewall (if enabled) needs to be configured to allow inbound TCP connnections to the XAML Spy Service. Both XAML Spy and the firewall need to be configured on the machine running the XAML Spy Service or else remote debugging will not work.
Firewall configuration is easy, the XAML Spy installer can configure the Windows Firewall automatically for you. Continue reading to learn more about the specifics of configuring remote debugging.
Enabling remote debugging is a configuration setting available in the XAML Spy settings. Navigate to settings > xaml spy service and check the option Enable remote debugging. When disabled, incoming connections that originate from an IP address other than the XAML Spy service address will be ignored. Remote XAML apps trying to connect to a XAML Spy service having remote debugging disabled will encounter a connection lost (or similar) error message.
Remote debugging requires at least one public facing IP address to be used by the XAML Spy service. If you host the XAML Spy service on the loopback interface (localhost, 127.0.0.1) only, remote debugging will not work. Either select the any IP address or a specific public facing IP address.
Do not forget to click the apply changes button after changing the XAML Spy service settings. Only then the XAML Spy Windows service is restarted and will use the new configuration settings. For more information about configuring the XAML Spy service, see this tutorial.
The section discusses how to automatically configure the Windows Firewall. When using other firewall products, you'll need to apply similar settings manually. Windows Firewall disallows remote TCP connections to the XAML Spy service by default. Either configure the Windows Firewall automatically during XAML Spy installation, or configure the firewall manually as is described in the section below. The following image shows the XAML Spy install dialog for automatic firewall configuration.
When configured automatically, the XAML Spy installer adds the following inbound rule to the Windows Firewall;
|Rule name||XAML Spy|
|Protocol and ports||Any|
|Scope||Remote IP addresses from the local subnet only|
|Profile||All (domain, private and public)|
An outbound rule does not need to be configured in the Windows Firewall. By default outbound connections that do not match a rule are allowed.
Follow these steps to manually configure the Windows Firewall.
XAML Spy connections are password protected. To further restrict access to the XAML Spy service you may consider the following options;
Once remote debugging is configured properly a remote app can connect to the XAML Spy Service. When referencing the XamlSpy nuget package, a remote connection will be setup automatically. When connecting manually, you will need to provide the correct remote IP address. For step-by-step tutorials on connecting manually see the How to connect documentation.
Once a remote connection has been established, the remote app automatically appears in the XAML Spy explorer. An app is identified as remote by the IP address of the remote machine it's running on.
When the firewall is configured to disallow access, the following error message is shown in the XAML app trying to connect. The error message is an indication that the firewall is actively preventing access to the XAML Spy Service.