Training
Module
Remotely debug ASP.NET Core apps hosted on Azure App Service using Visual Studio - Training
Hands-on training to deploy and remotely debug your ASP.NET Core apps on Azure App Service directly using Visual Studio 2022.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
You can debug apps running in either a Windows Docker Container or a Linux .NET Core Docker container using Visual Studio.
If it's not already present on the Linux server, you need to install SSH server, unzip and install with either curl or wget. For example, on Ubuntu you can do that by running:
sudo apt-get install openssh-server unzip curl
Secure File Transfer Protocol (SFTP) must be enabled as well. Most SSH distributions install and enable SFTP by default, but that is not always the case.
You can attach the Visual Studio debugger to a process running in a Linux .NET Core Docker container on your local or remote machine using the Attach to Process dialog box.
Important
To use this feature, you must have local access to the source code.
Note
You can use these instructions to attach to Linux Docker running in WSL over SSH, but your WSL instance must first run an SSH server. For example, you could install Open SSH Server (for example: sudo apt-get install openssh-server
), configure the server by editing the configuration file (for example: /etc/ssh/sshd_config), and then start the server (for example: sudo service ssh start
).
To attach to a running process in a Linux Docker container:
In Visual Studio, select Debug > Attach to Process (CTRL+ALT+P) to open the Attach to Process dialog box.
Set the Connection type to Docker (Linux Container).
Select Find... to set the Connection target via the Select Docker Container dialog box.
You can debug a Docker container process either locally or remotely.
To debug a Docker container process locally:
Set Docker CLI host to Local Machine.
Select a running container to attach to from the list and hit OK.
To debug a Docker container process remotely:
You can connect to a running process in a Docker container using one of two options. The first option, to use SSH, is ideal if you don't have Docker tools installed on your local machine. If you do have Docker tools installed locally and you have a Docker daemon that's configured to accept remote requests, try the second option, using a Docker daemon.
To connect to a remote machine via SSH:
To set the target to a remote container running a process via a Docker daemon:
Choose the corresponding container process from the list of Available processes and select Attach to start debugging your C# container process in Visual Studio!
You can attach the Visual Studio debugger to a process running in a Windows Docker container on your local machine using the Attach to Process dialog box.
Important
To use this feature with a .NET Core process, you must install the .NET Core Cross-Platform Development workload and have local access to the source code.
To attach to a running process in a Windows Docker container:
In Visual Studio, select Debug > Attach to Process (or CTRL+ALT+P) to open the Attach to Process dialog box.
Set the Connection type to Docker (Windows Container).
Select Find... to set the Connection target using the Select Docker Container dialog box.
Important
The target process must have the same processor architecture as the Docker Windows container it is running on.
Setting the target to a remote container via SSH is currently unavailable and can only be done using a Docker daemon.
To set the target to a remote container running a process via a Docker daemon:
Specify the daemon address (that is, via TCP, IP, and so on) under Docker host (Optional) and then choose Refresh.
After connecting to the daemon successfully, select a running container to attach to, and then choose OK.
Choose the corresponding container process from the list of Available processes and select Attach to start debugging your C# container process.
Training
Module
Remotely debug ASP.NET Core apps hosted on Azure App Service using Visual Studio - Training
Hands-on training to deploy and remotely debug your ASP.NET Core apps on Azure App Service directly using Visual Studio 2022.
Documentation
Debug apps in a local Docker container - Visual Studio (Windows)
Modify applications running in a local Docker container, refresh with the Edit and Refresh actions, and set debugging breakpoints.
Debug .NET apps in Linux using WSL - Visual Studio (Windows)
Discover how to run and debug your .NET applications in WSL without leaving the Visual Studio integrated development environment (IDE).
Debug .NET Core on Linux - Visual Studio (Windows)
Debug .NET Core and .NET 5 and later applications on Linux with Secure Shell (SSH), attach to a process, build and deploy the app, and attach the debugger.