Guerrilla
Guerrilla

Reputation: 14926

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?

Upvotes: 10

Views: 4413

Answers (1)

skjoshi
skjoshi

Reputation: 2533

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.

Upvotes: 10

Related Questions