“遠端除錯監視器(MSVSMON.EXE)似乎沒有在遠端計算機上執行“的完美解決方案

行一山人發表於2016-05-25

今天除錯程式時,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,轉載請註明出處。

 

相關文章