Is there a way to debug in Visual Studio, particularly when working with controllers? Whenever I try, I get a message that says, "Unable to start debugging on the web server. The debugger cannot connect to the remote computer. The debugger was unable to resolve the specified computer name."
If you are connecting to a remote instance.
- Ensure the msvsmon.exe the remote debugging service is running.
- Ensure the ports are accessible through firewall.
- Ensure your user has access to remote debug. This can be set in the remote debugging tool.
- Ensure the solution is built and deployed in debug mode
- Ensure the Visual studio version is same or less than the remote debugging tool installed
Visual Studio Debugging Enable the following settings before attaching the debugger.
- Navigate to Tools > Options > Debugging >
- General > uncheck Enable Just My Code
- Symbols > Add > Provide the file share path of the website bin folder \servername\c$\inetpub\wwwroot\ca-dev\bin
Attach Debugger Navigate to Debug > Attach to Process > Connection target > Enter server name servername:portnumber and it should list all the process from the remote server
Port number can be found in the service on remote server tools>options.
Choose the Sitecore instance (w3wp.exe) to debug and it should hit the break points when you browse the site.
Remote server On the remote server you should see the active connections or any error occurred while connecting.
I have detailed blog on remote debugging Sitecore and the issues that I faced while doing it. https://bala.one/remote-debugging-sitecore-visual-studio/
You cannot simply debug the code in visual studio when your Sitecore is sitting on a remote machine. When we debug, we attach dubugger to a local process w3wp.exe related to local application that we want to debug. You should install Sitecore locally to debug the code. Sitecore setup is quite easy for developers and you can follow the standard documentation for this. (I wanted to add this as a comment but for some reason I am seeing only the answer option)