“远程调试监视器(MSVSMON.EXE)彷佛没有在远程计算机上运行“的完美解决方案

今天调试程序时,Visual Studio忽然报出了以下错误:安全

Microsoft Visual Studio 远程调试监视器(MSVSMON.EXE)彷佛没有在远程计算机上运行。这多是由于防火墙阻止与远程计算机通讯。有关配置远程调试的协助,请参阅帮助。app

 

研究了半天,上网查找各类资料,怎么说的都有,但没有一个能真正解决此问题。笔者行一山人尝试了以下方法:ide

一、重装VS。本人使用的VS2015 Update1,新下的升级版,顺便安装升级到了VS2015 Update2,无效。网站

二、关闭防火墙,无效。this

三、关闭安全软件、杀毒软件,无效。spa

四、将杀毒软件一天内检测到的隔离文件所有恢复到原位置,无效。debug

五、将MSVSMON.EXE所在文件夹的权限改成everyone彻底控制,无效。调试

六、修改登陆帐户,赋予其Administrators权限,并从其它组中删除,无效。orm

七、重启系统、注销用户、重启VS,无效。rem

好吧我实在是没辙了,继续查资料。

中外网站都看了,只发现了一个惟一可行的方案,就是把生成的目标平台从Any CPU改成x86,这个方法能让调试启动,但不完美。我想编译64位的程序怎么办,仍是得面对这个问题。

 

经过查看微软的官方资料(https://msdn.microsoft.com/en-us/library/ms184681(v=vs.140).aspx),理解了为何本地调试会报远程调试错误。

Debug 64-Bit Applications

Visual Studio 2015
 

You can debug a 64-bit application that is running on the local computer or on a remote computer.

To debug a 64-bit application that is running on a remote computer, see Remote Debugging.

To debug 64-bit applications locally, Visual Studio uses a 64-bit worker process (msvsmon.exe) to perform the low-level operations that cannot be done inside of the 32-bit Visual Studio process.

Mixed-mode debugging is not supported for 64-bit processes that use .NET Framework version 3.5 or earlier.

Debug a 64-bit Application

To try debugging a 64-bit application:
  1. Create a Visual Studio solution, for example a C# console application.

  2. Set the configuration to 64-bit using the Configuration Manager. For more information, see How to: Configure Projects to Target Platforms.

  3. At this point the 64-bit version of the remote debugger (msvsmon.exe) starts. It runs as long as the solution with the 64-bit configuration is open.

  4. Start debugging. You should have the same experience as with a 32-bit configuration. If you get errors, see the Troubleshooting section below.

Troubleshooting 64-bit debugging

 

You may see an error: “A 64-bit debugging operation is taking longer than expected.” In this case, Visual Studio has sent a request to the 64-bit version of msvsmon.exe, and it has taken a long time for the result of that request to come back.

There are two main causes for this error:

  • You have networking security software installed on your computer that has caused the networking stack to be unreliable, and it has dropped packets going over localhost. Try disabling all network security software and see if this resolves it. If so, report to your network security software vendor that the software is interfering with localhost traffic.

  • You are running into a hang or performance problem with Visual Studio. If the problem happens regularly, you can collect dumps of Visual Studio (devenv.exe) and the worker process (msvsmon.exe) and send them to Microsoft. For information about reporting a problem, see How to Report a Problem with Visual Studio.

 

最终经过总结研究,终于找到了完美的解决方案,很是简单:

一、查看Windows Firewall服务(或其它防火墙软件)是否启动,若是启动则关闭。须要注意的是,有时防火墙服务会自动启动,因此即便是设置为手动模式,也要去确认一下。

二、删除项目目录下bin和obj两个文件夹,而后从新生成项目。在从新生成时可能会提示引用的DLL错误,从新引用报错的DLL后,再次生成便可。

这时发现项目又能正常调试啦!

 

有些问题确实奇怪,说难真难,但解决起来倒是如此简单,特此随笔以助有缘人吧。

By:行一山人Xingyihermit,Koala Studio,转载请注明出处。

相关文章
相关标签/搜索