Original URL http://www.codeproject.com/Articles/146838/Remote-debugging-with-Visual-Studio-2010

you may also need to set up window firewall for this. see URL https://msdn.microsoft.com/en-us/library/ee126350(v=vs.100).aspx

I've recently needed to remotely debug a .NET desktop application with Visual Studio 2010. After having read the MSDN documentation on this subject, I still missed some information. I hope that this post will fill some of these gaps and will help you configure and run the remote debugging tools.

Let’s first start with a definition of parts involved in the debugging process:

  • host – is a machine on which Visual Studio is installed and on which you control the debugging process
  • remote computer – is a machine on which the debuggee is run

Since the debugging process is wholly controlled from the host, there must be a listener on the remote computer that executes commands sent from Visual Studio. This listener is called Remote Debugging Monitor (msvsmon.exe). There are two possible ways to install it – you can either download and run the setup package from Microsoft or copy all the necessary files from C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Remote Debugger (path on my 64-bit Win7). A caveat here: If your host is x86 machine, then you have no choice but x86 package for your remote computer – there is no way you can debug a 64-bit process in a 32-bit debugger. Though you can debug 32-bit process in a 64-bit debugger.

Next step (the most boring and error prone in my opinion) is a network setup. Ideally Visual Studio and Remote Debugging Monitor should take care of the Windows Firewall settings after you run them with the elevated privileges, but life is life and you might need to get your hands dirty. Fortunately the manual configuration process is pretty well explained on MSDN sites for WinXP, Vista and Win7. The next important thing is security. You can either perform debugging in “NoAuthentication” mode (which is of course less secure) or in Windows Authentication mode. Unfortunately Windows Authentication mode requires the same account to be setup on the host and the remote computer – both usernames and passwords must be the same. If it’s a problem for you, then you are left with the “NoAuthentication” mode in which you take a risk of allowing all people to access your debugging monitor.

Having finished the configuration part, we may finally start the debugging process. Begin with starting msvsmon.exe (Remote Debugging Monitor) on the remote computer – it will communicate with Visual Studio running on the host. Let’s assume that our application is named RemoteControl.exe and is written in C#. First, we need to deploy it on the remote computer, for example into the C:\Users\concept\Desktop\RemoteControl folder (remember to copy also all the pdb files and the assemblies required by the main application). We can now either start the application under the debugger or attach the debugger to the already running process. Let’s start with the first scenario. If you have access to the application solution folder and to all the project files, then you can start the remote debugging by modifying the start project properties page:

If you don’t have access to the application solution, then you need to use the application EXE file. From File menu choose Open->Project/Solution… and find the EXE file for your application. Select the newly opened project and choose properties. Fill the page with following values:

Attaching to the already started process is fairly simple: From the Debug menu, choose Attach to process…. If you are debugging in the Windows Authentication mode, set the Transport box to Default. In Qualifier field, type name of your Remote Debugging Monitor session. Usually it is your user name + @ + the remote computer name, for example Sebastian@REMOTE-PC (the session name is also displayed in the listbox after you start the msvsmon.exe).

Finally, a few words about the debugging process. Unfortunately the debugging symbol configuration differs depending on the chosen debugging engine (native, managed, mixed). When using managed debugging engine symbols must be accessible on the remote computer (so you need to deploy your application with all pdb files and set_NT_SYMBOL_PATH variable on the remote computer for .NET Framework debugging symbols). When using native debugging engine symbols are loaded from the host machine (so you must include the directory with all pdb files for your application into the Visual Studio symbols search path – Tools->Options->Debugging->Symbols). Interestingly, source files are always loaded from the host machine (in case that you don’t use any kind of source server). To summarize: remember to always choose the managed engine for your .NET applications that don’t have any interop parts. The native engine requires much more information (like symbols for all native libraries) and provides you with capabilities that are usually not necessary in debugging pure .NET application.

I haven’t touched the subject of the web applications remote debugging and running Remote Debugging Monitor as a service. Leave a comment if you wish such a post to appear in the future.

转:Remote debugging with Visual Studio 2010的更多相关文章

  1. Visual Studio 2010初学者的调试指南:Mastering Debugging in Visual Studio 2010 - A Beginner's Guide

    Introduction In the software development life cycle, testing and defect fixing take more time than a ...

  2. Win7 32bit + Matlab2013b +Visual Studio 2010联合编程配置

    要建立独立运行的C应用程序,系统中需要安装Matlab.Matlab编译器.C/C++编译器以及Matlab C/C++数学库函数和图形库函数. Matlab编译器使用mbuild命令可以直接将C/C ...

  3. VS:101 Visual Studio 2010 Tips

    101 Visual Studio 2010 Tips Tip #1        How to not accidentally copy a blank line TO – Text Editor ...

  4. Creating SharePoint 2010 Event Receivers in Visual Studio 2010

    转:http://msdn.microsoft.com/en-us/library/gg252010(v=office.14).aspx Summary:  Learn how to create a ...

  5. 恼人的Visual Studio 2010崩溃重启问题

    上周时Visual Studio 2010突然出现崩溃现象.在源文件修改只要一编译,马上就崩溃,而且还不弹出任何异常窗口,严重影响软件开发工作. google了无数解决方案 试了下面这些方法: 1)h ...

  6. How To Compile Qt with Visual Studio 2010

    This post is a step-by-step guide on how to compile Qt 4.x.x with MSVC 2010. Although we use Qt 4.7. ...

  7. Visual Studio 2010 将网站直接发布到远程站点

    原文:Visual Studio 2010 将网站直接发布到远程站点 这次说下如何将web应用程序直接发布到IIS服务器站点!!! 问题的由来 本人每天要发布更新的程序,所以每次更新的时候要做的工作: ...

  8. ASP.NET 4 and Visual Studio 2010

    https://msdn.microsoft.com/en-us/library/ee532866.aspx The topics in this section provide informatio ...

  9. [入门级] 基于 visual studio 2010 mvc4 的图书管理系统开发初步 (二)

    [入门级] 基于 visual studio 2010 mvc4 的图书管理系统开发初步 (二) Date  周六 10 一月 2015 By 钟谢伟 Category website develop ...

随机推荐

  1. Delphi 重写控件的一个例子。

    unit DBGridEx;   interface   uses   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, ...

  2. ovs router

  3. poj1222

    貌似又是一个矩阵图形的问题,看起来应该是不太容易,不管了先做做吧! 题目大意: 题目:灯光延伸出去(延长熄灯)?? 在一个扩展的游戏版本 熄灯,它是一个难题(或者谜)在一个5行每一行有6个按钮(实际是 ...

  4. 如何高性能的给UIImageView加个圆角

    文/natewang(简书作者)原文链接:http://www.jianshu.com/p/268f3839d2e6著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”. 其实你只需要的是圆角 ...

  5. sed替换文件中的字符串

    sed -i 's/原字符串/替换字符串/g' filename

  6. Java父类子类的对象初始化过程

    摘要 Java基本的对象初始化过程,子类的初始化,以及涉及到父类和子类的转化时可能引起混乱的情况. 1. 基本初始化过程: 对于一个简单类的初始化过程是: static 修饰的模块(static变量和 ...

  7. dependencyManagement与dependencies区别

    最近在阅读maven项目代码时,dependencyManagement与dependencies之间的区别不是很了解,现通过项目实例进行总结:项目epps-demob-pom下有一个模块是epps- ...

  8. OPENCV第一篇

    了解过之前老版本OpenCV的童鞋们都应该清楚,对于OpenCV1.0时代的基于 C 语言接口而建的图像存储格式IplImage*,如果在退出前忘记release掉的话,就会照成内存泄露.而且用起来超 ...

  9. Valgrind 安装与使用

    调不尽的内存泄漏,用不完的Valgrind Valgrind 安装 1. 到www.valgrind.org下载最新版valgrind-3.2.3.tar.bz2 2. 解压安装包:tar –jxvf ...

  10. cocos2d-x项目过程记录(cocos2d-x的新知)

    1.给CCMenuItem带上点击参数(这是CCNode的一个属性) CCMenuItem *item = CCMenuItemSprite::create(unselectedPic, select ...