Problem
We are upgrading from Sitecore 8.2.1 to Sitecore 10.1.1. We are moving towards containerized solution using Dockers as it is officially supported by Sitecore now. Most of the development team has worked on non-docker based Sitecore instances and are still adopting to working with containers based applications. One of the confusions pretty much every developer had was how to debug a Docker based containerized application.
Solution
Debugging container based application using Visual Studio is slightly different. In Visual Studio, you have two options for attaching to a process in a container:
Option 1: use the Containers window
To use the Containers window:
If the Containers window is not showing, open it from the top View menu. Click Other Windows, then Containers.
In the list of running containers, right-click on the one that you want to debug, and click Attach to Process:
The Attach to Process dialog appears and shows the available processes running in the container:
For Attach to Process, you check that the correct code type is selected. For debugging a CM or CD
w3wp.exe
, this will be Managed Code (v4.6, v4.5, v4.0).Select the process (for example, w3wp.exe) as usual (check Show processes from all users if not visible), and click Attach.
Option 2: Use the Debug menu
Alternatively, you can also use the Debug menu, although this involves a few more steps than the Containers window.
To use the Debug menu:
- From the top Debug menu, click Attach to Process to open the Attach to Process dialog.
For Connection type, click Docker (Windows Container).
For Connection target, click Find. Running containers appear in the list. Select the container you want to debug and click OK.
For Attach to, ensure the correct code type is selected. For debugging a CM or CD
w3wp.exe
file, this is Managed Code (v4.6, v4.5, v4.0).Select the process (for example, w3wp.exe) as usual (check Show processes from all users if not visible), and click Attach.
Comments
Post a Comment