RemoteDebugWindows

It is possible to debug IIS and Shibd remotely. The following works for the specific pairing of VS2015, Server 2016 and IIS 10.0.14393.0. Other variants are likely to work with suitable amendment

Preparing the Server Machine

  • Ensure that IIS is running (if you are going to debug IIS) 

  • Ensure that Shibboleth is installed

  • Download and install the appropriate Remote Debugging tools

  • You need to start the Remote Debugger Tool (as admin) everytime you log/reboot the system.  It defaults to using port 4020.

  • If will use the debug build ensure that the debug directories are on the system PATH

  • Stop IIS (from the console).

Setup The Visal Studio Project


Chose the project which you wish to debug (probabaly isapi_shib or iis7_shib and (for ease) mark it as the startup project. That way when this is all done hitting F5 will compile, deploy and run the executable.

Set up deployment the Configuration Manager (Build->Configuration Manager). Select the appropriate configuation and platform and tick the "deploy" box for the appropriate project.

Set up the debung but right clicking on the project, selecting properties and then the Debugging menu (again for the appropriate configuation and platform),

Make the following settings:

Debugger to Launch

Remote Windows Debugger

Remote Command

C:\Windows\System32\inetsrv\w3wp.exe

Remote Command Arguments

-debug

Working Directory

c:\opt\shibboleth-sp\....

Remote Server name

whatever.example.org:4020 (gotta have the port)

Debugger Type

default (auto) or "Native Only"

Deployment Directory

Probably C:\opt\shibboleth-sp\lib64\shibboleth\debug

Set an appropriate break point. When you try to run the project for the first time there will be a login dialogue (login with an admin user) then the Remote Debugger tool will show you to be logged in. Finally a command window will pop up as IIS starts.

Remote shibd

These are the settings I use

Debugger to Launch

Remote Windows Debugger

Remote Command

C:\opt\shibboleth-sp\sbin64\debug\shibd.exe

Remote Command Arguments

-console

Remote Server name

whatever.example.org:4020 (gotta have the port)

Connection

default (auto) or "Native Only"

Deployment Directory

C:\opt\shibboleth-sp\sbin64\debug

Attaching to a running process

It is also possible to attach to a running process ( shibd.exe, w3wp.exe, httpd.exe).  Start at the Debug→Attach to Process..dialog.  Leave Connection type as Default and put in the name of the remote host in the "Connection Target" dialog.