Now the standard dotnet docker images, which are based on Linux container, could host ASP.NET/.NET Framework applications as well. So it's always recommended to use Linux container to host applications.
Rider's "Attach on Docker" feature doesn't support Windows container, in case you want to debug a .NET process on Windows container (for example, ASP.NET process on w3wp instance), you can take the container as a normal remote SSH host and connect on it.
Below is a sample of how to configure SSH debugger host on a container, which is hosting an ASP.NET Framework MVC application.
-
Download the JetBrains SSH Server executable on the container. Optionally, copy the executable on the container build stage. (Ensure the executable file is not excluded by
.dockerignore.Expose the SSH port on container, for example, below snippets expose the port
1234as SSH port. To simplify the steps, use VS with docker support to build the image and create the container here. (Detach VS after the container is created)FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019 COPY jetbrains_debugger_agent_20230319.24.0.exe c:/ EXPOSE 1234 USER ContainerAdministrator ARG source WORKDIR /inetpub/wwwroot COPY ${source:-obj/Docker/publish} . -
Two ports should be bridged to the local machine, check on Docker Desktop.
-
When ready to attach the container in Rider, go to the container's terminal in Docker Desktop and start the debugger agent in the container.
-
In Rider, create a new SSH remote host and input the credential.
-
In Run | Attach To Remote Process, use the connection just created. Select the
w3wpfor debugging. -
Start debugging as normal.
Comments
0 comments
Please sign in to leave a comment.