Reputation: 3155
I was trying to remotely debug a ASP .net application installed in the client's windows server 2012. I installed Remote debugger in the remote machine and ran it in administrator mode. (Even After) Following the Microsoft instructions, I was hit by serious of errors - most of which are configuration error which was not detailed (or overlooked) in the instructions.
After all the setup hurdles, I managed to attach the process W3WP.EXE but I was not not able to debug the remote application.
Debugger gave the standard warning - No Symbols have been loaded for this document
(I tried copying .Pdb file to the remote machine - making sure that the versions in local copy and in remote copy are same).
Am I missing any steps ? A detailed walk through would help.
Upvotes: 2
Views: 5189
Reputation: 11
I had the problem that i created an ASP.NET application with latest .NET-framework (4.8). After changing to 4.6.1 (which made a lot of problems) i was able to debug the remote application finally.
Upvotes: 0
Reputation: 560
One step that is not clearly documented is that in the remote applications web.config file, compilation debug must be set to true:
<system.web>
<compilation targetFramework="4.5" debug="true">
...
Upvotes: 4
Reputation: 3155
Consider the following situation:
We have deployed a web application on a client machine and the client reports a bug. Then we try to replicate the problem in our local environment (where the code exists), but could not succeed. Now there are two ways to debug the client installation – either through log files or through visual studio debug mode. If our logging is not detailed, we will have nightmares in troubleshooting. The other option is installing visual studio in a server machine (which is not a great idea).
To solve this remote debug problem, we can use a tiny tool called Remote Debugging Monitor (MSVSMON.EXE). It lets you run, debug, and test an application that is running on one device (client machine) from another computer (local development environment) that is running Visual Studio.
Pre-Requisites:
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 debugging components.
You must be an administrator to install the remote debugger on the remote device. To communicate with the remote debugger, you must have user access to the remote device.
Installation:
Instructions:
Before connecting to the client machine, first initiate a worker process on the client PC. To initiate a worker process you need to run the application, the IIS will do the rest.
Once started, open the instance of visual studio where the original code was developed and navigate to Debug -> Attach to Process
By default this lists the process running in the local machine.
To connect to the remote server’s process, enter the machine name in the Qualifier field (Editable field). This detail can be obtained from the Remote Debugging Monitor. It displays the machine name with the port number once Remote Debugging Monitor (MSVSMON.EXE) is started.
If you are accessing the Remote Debugging Monitor outside the domain, it will prompt for authentication. Authorization is based on the permission as configured in the Remote Debugging Monitor (under permission settings as discussed earlier).
Once connected, we can attach to the required process to debug the application. In this instance, to debug the ASP .Net application we have attached to W3WP.exe of the remote machine (Client installation).
Now the Visual Studio debug will work as expected from the local machine (development environment). For process requiring higher permissions, you need to run the Remote Debugging Monitor (MSVSMON.EXE) as admin in remote machine.
Troubleshooting:
Sometimes even if you attach the correct process, the VS Debug mode does not detect the process. It might be due to one of the below reasons:
• Make sure you copy the .PDB file that is generated with your assembly into the same folder on the remote machine. This will allow the debugger to pick up the debug symbols.
• Make sure that you are using the correct version of MSVSMON.exe – 64 bit version is for debugging 64 bit C# application – Which cannot be used with x86 application instance.
References: Part of this procedure was taken from Microsoft instructions, blog post and from stack overflow discussion.
Upvotes: 2