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

今天调试程序时,Visual Studio突然报出了如下错误:

Microsoft Visual Studio 远程调试监视器(MSVSMON.EXE)似乎没有在远程计算机上运行。这可能是因为防火墙阻止与远程计算机通信。有关配置远程调试的协助,请参阅帮助。

 

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

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

2、关闭防火墙,无效。

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

4、将杀毒软件一天内检测到的隔离文件全部恢复到原位置,无效。

5、将MSVSMON.EXE所在文件夹的权限改为everyone完全控制,无效。

6、修改登录账户,赋予其Administrators权限,并从其它组中删除,无效。

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

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

中外网站都看了,只发现了一个唯一可行的方案,就是把生成的目标平台从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.

 

最终通过总结研究,终于找到了完美的解决方案,非常简单:

1、查看Windows Firewall服务(或其它防火墙软件)是否启动,如果启动则关闭。需要注意的是,有时防火墙服务会自动启动,所以即使是设置为手动模式,也要去确认一下。

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

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

 

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

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

 

你可能感兴趣的:(“远程调试监视器(MSVSMON.EXE)似乎没有在远程计算机上运行“的完美解决方案)