September 11, 2010
Consider this. You created an app and installed the exe (or the dll) on a remote server. You want to debug the process on that remote server from your development machine.
And when you do, you get:
Enter the curious world of remote debugging.
There are lots of forumposts about this subject but they are just pieces of the puzzle. So let’s grab this problem as a whole and see how I solved it. And hopefully it will work for you too.
First, install the Remote Debugger on the remote machine (which runs the process with the dll you want to debug). The Remote Debugger is located on the Visual Studio (2008 or 2010) DVD. You can configure the remote debugger after installation or later (VS program folder -> VS Tools -> Remote Debugger Configuration Wizard). When you enable the Remote Debugger Service, make sure you enter an account with appropriate rights. So enter the administrator account, just to make sure it works.
Second Install Process Explorer just to make sure your code actually runs. Because one reason you get the dreaded ‘The breakpoint will not currently be hit’ is because the dll is not loaded at all, hence it does not run. So start up Process Explorer and select your exe. Then check the .NET Assemblies tab and check if your dll is actually there.
Third. Make sure the dll in the Debug folder in your VS Soluition is the same as the dll on the remote machine. I can not stress that enough (lol, I always wanted to say that: I can not stress that enough). So delete the contents of your debug folder just to be sure, CLEAN, BUILD, and deploy that same dll on your remote machine.
FifthThe most important step is to make sure the remote machine can access the .pdb file. This file contains the symbols that could be loaded. So put it somewhere on a share or where ever, and configure Visual Studio to use that location.
In Visual Studio go to Tools -> Options -> Debugging -> Symbols.
This should be it. Now go to Debug -> Attach To Process and enter the name of the remote machine you want to be debugged. Click Refresh and select the right process. (the one from you app, OK). Click Attach and your breakpoints will be hit! Well maybe after a little while, depends when the dll is called from within the process.
Please let me know if this did not work for you.