Remote Debugging .net - visual-studio

I've read all related remote debug entries here and couldn't find an answer to my problem. I've trying to setup remote debugging to test a console app.
Dev Machine - Vista, VS 2008
Remote Machine - Win 2008
I've followed the steps in this article to configure it and I'm stuck with the following error when I try to list processes in remote machine under 'Attach to Process'.
"The remote procedure call failed and did not execute".
But in my remote machines 'Remote Debug Monitor' I see that the dev machine connection was established.
Can anyone provide me with any clues?

Whenever I run into this problem the first thing I do is disable the firewall on both computers. Firewall problems are the most common issue I run into with remote debugging and it's best to eliminate that problem from the start.
Do take care to turn the firewall back on when you're done diagnosing the problem :).

Related

VS2015 Unable to connect remote debugger

I have VS2015 locally. Windows 2012 R2 server hosting an IIS8 test website.
I've put the updated DLL and PDB files in the BIN of the test website.
Step 1) On the remote server, I make sure the Remote Debugger is started.
Step 2) While in VS, I navigate to Debug => Attach to Process. Click "Find". Then click "Select"
This is when the error shows up "Unable to connect to 'address'. An operation is not legal in the current state."
I noticed the Qualifier port was changed, and is different than what shows in Step 1... so I try manually changing what's in the Qualifier to match.. but same issue.
I see the "Transport" is changed from Remote to WebKit. Not sure if this is a problem...
I figured it out. Instead of choosing Remote in the Transport dropdown. Select Default and then put your server in the textbox. Even though I am doing remote debugging, it solved the problem.
I got the same error while I tried to attached my solution with running localhost application hosted in iis. I just fixed it by selecting "Native code" in the "Attach to" field of the "Attach to Process" dialog.
In my scenario, a process running on a machine behind firewall had to be debugged. Usual steps did not help in discovering the machine or its process by selecting the Remote (No Authentication) option.
The following steps helped in remote debugging the process with firewalls on:
Run Remote Debugger on remote machine. The remote machine may have the firewall on. Leave Remote Debugger to run with Authentication Mode as Windows Authentication.
On the debugging machine, go to Debug->Attach to Process, and leave Default in Transport drop-down. Enter the IP of the remote machine for Qualifier and press Enter. This will ask to provide credentials to log into remote machine. Provide credentials. Processes running on the remote machine should now be listed under Available Processes
If the intended process on remote machine is not listed in Available Processes, check ""Show processes from all users"". This should show the process intended to be debugged.
If the break points are not loaded or hit when expected, go to Tools->Options->Debugging-> Uncheck Enable Just My Code. Break points should now hit.
Hope this helps.
Can a moderator add tags remote debugging and remote debugging with firewall to this post, and remove this line?

Remote debug a Windows service using VS2012

I've tried to find an answer to this before posting this question. I've got a windows service running on another machine. I've written the service in C# and the directory from which the service executable runs holds both executable and debug files (.pdb). I'm attempting to remote debug the service for the first time using VS 2012 Remote debugging. I'm able to attach to the service process successfully. However, as this is my first time I'm not sure what I can do next. I've clicked the pause button and that pauses the service on the line ServiceBase.Run(ServicesToRun) which isnt much use to me. The service has a timer which sets off every 30 seconds and will run the code in the timer event.
My question is ... is there a way of stepping through the code using the debugger in such a scenario.
Do I need to have some debug specific code already in my codebase so that when a debugger attaches it will take me to a place in the code from where i can step through the code?
Thanks,
Andrew.
There are several ways to debug your developed remote application or windows service. If you were in your machine(local) that would be simple to debug.
System.Diagnostics.Debugger.Launch();
But as you are in different machine it depends how your both Machines are connected. Which means you have some limitations on debugging remote application/services.
A Quick search gave me the following result that seemed helpful to me for you,
You can use Remote Debugging Monitor that visual studio use for connecting to remote device and debugging. You can have a clear instruction here on How to: Run the Remote Debugging Monitor.
There's another tool which lets you debug remote application's after a proper setup. But it has some limitations or conditions that you must abide by.
Here is the tool named Remote Tool, you can find a detailed setup process from MSDN here on How to: Set Up Remote Debugging.
It has been clearly quoted there about the prerequisites for using this tool. But still I'm rephrasing those again for quick reviewers.
Prerequisites to use Remote Tool for Visual Studio
To debug on a remote device:
The remote device and the Visual Studio computer must be connected over a network or connected directly through an Ethernet cable. Debugging over the internet is not supported.
The remote device must be running the Remote Tools for Visual Studio 2012.
You must be an administrator to install the remote tools on the remote device. To communicate with the remote tools, you must have user access to the remote device.
Feel free to share if you get to a better and working solution.
Thanks for your response. It reminded me to post my solution here for others like me.
The solution is simple (It always is once you know it).
Ensure that you are running the same code on the target machine as you have open in Visual Studio. It has to be the same assembly and version else the debugger will not hit your breakpoints. Ensure you have your breakpoints setup where you want the debugger to break execution. Then attach to the target machine process and wait for the timer to kick in and run the process where you breakpoint is set.
Hope this helps.
Andrew.

Remote debugging error unable to connect and the remote computer is not responding?

I have been messing with remote debugging so finally out of despair here I am. I am trying to connect to a Win 2003 remote machine where I have remote debugging installed (NO VS installed on this machine.) following this tutorial. So, I have added all the ports to exceptions in the firewall and I am trying to connect from my visual studio 2010 (run as administrator) and windows 7 Home Premium local machine using No authentication method by attaching it to a process. (For some reason I cannot use windows authentication and gives me edition not supported error!)
What happens is on the debug monitor it says that User has connected but then it just sits there waiting and finally gives an error Unable to connect to xxx.xxx.xxx.xxx. The remote machine is not responding. I tried to research a lot and also created a user with the same name as on the local machine on the remote machine. Also I used telnet as mentioned in the link and it does not show connected to the remote system message but does not show that it failed either and just sits there. I am guessing it something to do with the port not open correctly.Also after the first connection attempt when I try to connect again the remote debug monitor does not show any connected message and also the error I get is that remote debug monitor is not setup or running on the machine (almost like the debugger stops reponding). I am pretty exhausted trying out all the options can anyone give me more direction here ? Thanks !

VS 2010 Remote debugging not working

Hey everyone, I'm having trouble configuring my remote debugging set up. I've been searching and reading for a while, but I can't figure it out. I'm running windows 7 as the pc I'm running VS on and then have windows 7 running in virtual box as the pc that is running the program I'm trying to debug. I'm trying to debug a .NET 4 project.
Both computers are not part of a domain (I'm not sure if that matters). I'm running the debug monitor on the virtual pc via a shared folder on the non-virtual pc.
When I try to connect to the remote pc in the attach to process window in VS it connects, but fails to launch, and I get an error that says
Error while trying to run project: Unable to start debugging.
The specified network name is no longer available.
Let me know if I need to say anything else about my set-up.
Thanks for the help!
I finally figured out my problem(s).
I was using the wrong PC name to connect to the host machine. I was using the Server name that you can type in the VS remote debugging monitor. I had it working when I did the server as 'Stephen#192.168...' where that was the actual ip address on my subnet
Windows didn't properly configure the firewall ports for me. I had to manually open the DCOM ports to get it connecting.
I had to clear the existing credentials for each machine once everything else was set up as is shown here http://msdn.microsoft.com/en-us/library/2dbesfyx.aspx
Thanks everyone for your help and pointers.

Visual Studio Remote Debugging on XP Embedded - tried everything, please help!

I need to debug some C# code on a remote machine running XP Embedded. I did remote debugging on several occasions on different Windows operating systems and all worked well, but I think that the XP Embedded OS is missing something.
I'm popping my brains out in the last couple of days, reading and trying stuff, but nothing seems to work. So if you have been in the same situation and found a solution, please help. Here is what I did up to now:
Successfully established a remote debugging connection to an XP Professional environment, so I know that there's nothing wrong with my remote configuration.
Started the same services on the Embedded environment that are running on the Professional environment.
Configured DCOM permissions, firewall, local users with same name and passwords on both local and remote machines. Gave local users administrator rights.
Started msvsmon.exe both as an application and as a service, under the local user account, wich also has log on as a service rights.
Triple-checked that there is no other firewall between the machines that could drop remote debugging packets.
If I use the No authentication (native only) mode on the Embedded machine, the remote debugging works and I can see the processes. Otherwise, I get an error:
Unable to connect to the Microsoft Visual Studio Remote Debugging Monitor named '[NAME]'. The debugger cannot connect to the remote computer. This may
be because the remote computer does not exist or a firewall may
be preventing communication to the remote computer. Please see
Help for assistance.
Thank you for the time you took to read this and any suggestion may help. Thanks!
Can you use WireShark to capture the data going to the remote XP embedded device? If you get a TCP acknowledgement, at least you'll know it's not a firewall problem.
Did you tried to start msvsmon.exe with admistrator rights ? Maybe that is the issue, a post by John Robbins explains it : http://www.wintellect.com/CS/blogs/jrobbins/archive/2010/06/15/vs-remote-debugging-across-workgroups-or-domains.aspx.

Resources