Introduction: With the help of this article. we can debug our ASP.Net web application remotely. If our target machine has low memory or any problem like web application now work properly on any other machine then local in this case we can use this remote debugging to solve our problem .
Background: For the past few months I have been writing and debugging .NET applications for the Tablet PC. The Toshiba tablet I have been working with is not the fastest thing in the world and developing with it has been slow. I’ve now taken advantage of my more powerful desktop as my primary development machine and used remote debugging in Visual Studio .NET to run the applications on the target device (the Tablet) while still being able to walk through code on my PC. It is fairly simple to setup and faster than I had imagined.
Steps For Setup
I used the following MSDN article to get me going and I’ve added a few things to
streamline the process.
1. Install Remote Debugging Components on the Target Machine
The target machine that you wish to run the application on while debugging needs to have
the remote debugging software components installed. You can install just the individual
DLLs or just run the Visual Studio .NET installer and only select the “Remote Components
Setup” option (this is how I installed it).
For more info check out the link below:
2. Setup Your Visual Studio .NET Project
Open the properties window for your project in Visual Studio .NET. Under the
“Configuration Properties” folder in the “Debugging” set “Debugger Mode” from “Project”
to “Program”. You then need to enter the path and filename on the remote machine where
we will eventually copy the executable in the “Start Application” field, but you will
notice that this is still grayed out. Click on the “Apply” button and this field will be
enabled. For this example we will us the path and filename
Set “Enable Remote Debugging” to TRUE and then enter the WINS name of the remote machine
in the “Remote Debug Machine” field (we will user RemoteXP for the name of our remote PC).
Click OK to save your changes.
3. Copy The Executable To the Remote Machine
You have to have a copy of the executable on the remote machine
(in the directory we previously specified)
for remote debugging. But it is a big pain to remember to copy it again every time you
rebuild. I used the build events in Visual Studio to help automate this process.
Open the project properties window again and go to the “Build Events” section under
“Common Properties”. Click on the ellipsis in the “Post Build Event Command Line” field
to bring up the command window. Enter the following line:
DEL \\RemoteXP\\C$\RemoteDebug\*.* /Q
This will delete any previous versions of the executable. Hit enter and on the next line
COPY “$(TargetDir)*.exe” “\\RemoteXP\\C$\RemoteDebug\”
This will copy the application executable to the remote machine.
Click OK twice to save your changes. Now ever time you start the debug process and
the project is automatically built, the new application executable will be copied to
the remote machine. Now press F5! The app will start on the remote machine and you
will be able to step through your code on the local machine.