Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remote debugging ASP.NET Core on a Linux server

How do I attach the Visual Studio debugger to an ASP.NET Core application running on an Ubuntu server?

I really need to step through my code on the server to see what is going on. Is that possible yet?

like image 376
Guerrilla Avatar asked Feb 27 '17 10:02

Guerrilla


People also ask

Can .NET core work on Linux?

When Microsoft launched their . Net Core framework the key selling point was it is a cross-platform framework, which mean't that now we can host our . Net application not only on Windows but on Linux too, so let's see how we can deploy .

How do I enable remote Debugging on my server?

Set up the remote debugger on Windows ServerOn the remote computer, find and start the Remote Debugger from the Start menu. If you don't have administrative permissions on the remote computer, right-click the Remote Debugger app and select Run as administrator. Otherwise, just start it normally.


1 Answers

This blog post from Microsoft shows that this is certainly possible. You will be debugging the process over SSH.

You will need minimum the 1/27/2017 update (RC3) for Visual Studio 2017 RC. Also, you need to install a few utilities like openssh-server, unzip and curl on your server.

Then you can deploy a debug release to the your Ubuntu server. The Linux debugger needs Portable PDBs to be enabled (which is the default).

Attach the debugger and select SSH as the connection type.

Change Connection Target to the IP address of the Ubuntu server.

Select the required process (dotnet) to debug and click "Attach".

You will get a dialog to select which type of code you would like to debug. Pick Managed (.NET Core for Unix).

It should enable you to start debugging the ASP.NET Core app deployed on Ubuntu.

like image 197
skjoshi Avatar answered Oct 23 '22 04:10

skjoshi