Today’s post comes to us from Premier Developer consultant Randy Patterson. It’s an excellent tutorial that walks you through setting up Visual Studio to remotely debug ASP.NET Core applications running on a Linux server.
.NET Core and specifically ASP Core is an Open Source, High Performance implementation of .NET that runs on Windows, Linux and Mac. After you deploy your web application to a Linux server it can be difficult to troubleshoot when issues arise. In this article, I’ll show you how to configure your Linux test server and Development environment to allow remote debugging giving you all the greatness of debugging in Visual Studio while your code is running on a Linux server.
What you’ll need
- A Linux Virtual Machine running Ubuntu 16.04 server – GUI not required. For a complete list of supported Linux Distributions please see https://docs.microsoft.com/en-us/dotnet/core/linux-prerequisites?tabs=netcore2x
- Windows Developer Laptop with:
- Visual Studio 2017 Community edition or greater
- .NET Core 2.0 SDK Installed
Install dependencies on the Linux test server
Many different distributions of Linux are supported but for this article will assume a fresh install of Ubuntu 16.04 server edition. In order for Visual Studio to remotely connect and debug .NET Core applications the Linux server will require an SSH Server for use by Visual Studio (more on this later) and Unzip and Curl packages installed to allow Visual Studio to install the correct version of the remote debugger.
Log into the Linux test VM and issue the following commands:
sudo apt-get update
sudo apt-get install openssh-server unzip curl