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."
-
Yes there is... are you debugging debugging code on your local machine or a remote server? This isn't a Sitecore specific issue per se, but you'll need to provide more details and maybe some screenshots of what you are doing would be useful.– jammykamCommented Mar 23, 2020 at 22:45
-
Okay what information and screenshots would you like? I am debugging code on a local machine, but my Sitecore instance is on a remote server. I am really confused about what I am doing because I didn't set up the environment and have just started working with Sitecore.– Olivia ShettlesCommented Mar 24, 2020 at 2:37
-
Hi @OliviaShettles Do you have access to the remote server and have permission to copy files or do remote desktop?– Somnath DuttaCommented Mar 25, 2020 at 20:04
2 Answers
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)