0

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. – jammykam Mar 23 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 Shettles Mar 24 at 2:37
  • Hi @OliviaShettles Do you have access to the remote server and have permission to copy files or do remote desktop? – Somnath Dutta Mar 25 at 20:04
2

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

https://docs.microsoft.com/en-us/visualstudio/debugger/remote-debugging-csharp?view=vs-2019#download-and-install-the-remote-tools

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/

|improve this answer|||||
-1

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)

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.