转:Remote debugging with Visual Studio 2010
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的更多相关文章
- 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 ...
- Win7 32bit + Matlab2013b +Visual Studio 2010联合编程配置
要建立独立运行的C应用程序,系统中需要安装Matlab.Matlab编译器.C/C++编译器以及Matlab C/C++数学库函数和图形库函数. Matlab编译器使用mbuild命令可以直接将C/C ...
- VS:101 Visual Studio 2010 Tips
101 Visual Studio 2010 Tips Tip #1 How to not accidentally copy a blank line TO – Text Editor ...
- 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 ...
- 恼人的Visual Studio 2010崩溃重启问题
上周时Visual Studio 2010突然出现崩溃现象.在源文件修改只要一编译,马上就崩溃,而且还不弹出任何异常窗口,严重影响软件开发工作. google了无数解决方案 试了下面这些方法: 1)h ...
- 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. ...
- Visual Studio 2010 将网站直接发布到远程站点
原文:Visual Studio 2010 将网站直接发布到远程站点 这次说下如何将web应用程序直接发布到IIS服务器站点!!! 问题的由来 本人每天要发布更新的程序,所以每次更新的时候要做的工作: ...
- ASP.NET 4 and Visual Studio 2010
https://msdn.microsoft.com/en-us/library/ee532866.aspx The topics in this section provide informatio ...
- [入门级] 基于 visual studio 2010 mvc4 的图书管理系统开发初步 (二)
[入门级] 基于 visual studio 2010 mvc4 的图书管理系统开发初步 (二) Date 周六 10 一月 2015 By 钟谢伟 Category website develop ...
随机推荐
- 【转】Chrome保存mhtml网页文件的方法 – 无需任何插件,完美!
原文网址:http://www.ihacksoft.com/chrome-save-mht.html 在 Chrome 地址栏中键入“chrome://flags”,回车,这是一个 Chrome 的功 ...
- Delphi WEB APP DEBUGGER是如何使用的
WEB APP DEBUGGER是怎么使用的最近在写一个WEBSERVICE的程序,怎么设置使用,WEBAPPDEBUGGER这个工具呢,让别人在调用我的WEBSERVICE的时候我可以调试的?谢 ...
- 光学字符识别OCR
1.功能: 光学字符识别(OCR,Optical Character Recognition)是指对文本资料进行扫描,然后对图像文件进行分析处理,获取文字及版面信息的过程 2.典型应用: 名片扫描 3 ...
- SRM 504(2-1000pt)
DIV2 1000pt 题意:对于一个n*m的矩阵,每个格子都有一个颜色B或者W.对矩阵A执行以下程序后变成矩阵B.给出矩阵B,求A.(若有多种情况,输出字典序最小的).(n,m <= 16) ...
- 理解Android的startservice和bindservice(转)
一.首先,让我们确认下什么是service? service就是android系统中的服务,它有这么几个特点:它无法与用户直接进行交互.它必须由用户或者其他程序显式的启动.它的优先级比较高,它比处于前 ...
- Hard 计算0到n之间2的个数 @CareerCup
一种是Brute force,O(nlogn) 另一种是找规律O(n),见http://hawstein.com/posts/20.4.html 当某一位的数字小于2时,那么该位出现2的次数为:更高位 ...
- 饿了么 ---Java面试
下午去饿了么参加面试,其实也满怀期待,毕竟也是个大公司. 交通:偏外环,真北路 环境:感觉压抑,不通风,面试人很多,可能是屋子高度低,不舒服. 填了资料,等待面试,两轮,真是憋屈 都是搞技术的,何苦为 ...
- iOS中ASI和AFN的区别
一.底层实现 1> AFN的底层基于OC的NSURLConnection和NSURLSession 2> ASI的底层基于纯C语言的CFNetwork框架 3> ASI的运行性能 高 ...
- Java里的IO流里的FileReader里的BufferedReader读取并在前打印行数!
哈哈!!我又来了!!这个里面没有运用readLine 的方法!!纯手打!! import java.io.BufferedReader; import java.io.FileNotFoundExce ...
- CentOS 安装 Tomcat
1.Tomcat官网获(http://tomcat.apache.org/)取tar.gz文件的下载地址 2.下载: # wget http://apache.fayea.com/tomcat/tom ...