如何防止在Tab关闭时停止调试器

时间:2016-05-25 12:02:06

标签: c# asp.net asp.net-mvc debugging visual-studio-2015

我有一个ASP.NET MVC - 使用" IisExpress"调试时当我调试( F5 )项目时,会在浏览器中打开一个新选项卡。

当我现在关闭该浏览器中的任何标签(而不是运行我尝试调试的网站的那个)时,调试立即结束。我正在使用Chrome,但我不希望这是特定于浏览器的。

如何改变?

Update1 :值得一提的是,该解决方案有多个启动项目,其中一个是SharePoint加载项

Update2 :关闭选项卡并在调试停止之前,已将以下内容写入输出日志。:

The program '[4208] chrome.exe' has exited with code 0 (0x0).
The program '[15492] iisexpress.exe: Program Trace' has exited with code 0 (0x0).
The program '[10364] chrome.exe' has exited with code 259 (0x103).
The program '[12380] chrome.exe' has exited with code 259 (0x103).
The program '[10076] chrome.exe' has exited with code 259 (0x103).
The program '[8060] chrome.exe' has exited with code 259 (0x103).
The program '[8076] chrome.exe' has exited with code 259 (0x103).
The program '[7488] chrome.exe' has exited with code 259 (0x103).
The program '[7636] chrome.exe' has exited with code 259 (0x103).
The program '[12972] chrome.exe' has exited with code 259 (0x103).
The program '[15492] iisexpress.exe' has exited with code -1 (0xffffffff).
The program '[7384] chrome.exe' has exited with code 259 (0x103).
The program '[7468] chrome.exe' has exited with code 259 (0x103).
The program '[7476] chrome.exe' has exited with code 259 (0x103).
The program '[7884] chrome.exe' has exited with code 259 (0x103).
The program '[13360] chrome.exe' has exited with code 259 (0x103).
The program '[9768] chrome.exe' has exited with code 259 (0x103).
The program '[13804] chrome.exe' has exited with code 259 (0x103).
The program '[11008] chrome.exe' has exited with code 259 (0x103).
The program '[6920] chrome.exe' has exited with code 259 (0x103).
The program '[7364] chrome.exe' has exited with code 259 (0x103).
The program '[7372] chrome.exe' has exited with code 259 (0x103).
The program '[7392] chrome.exe' has exited with code 259 (0x103).
The program '[7400] chrome.exe' has exited with code 259 (0x103).
The program '[7420] chrome.exe' has exited with code 259 (0x103).
The program '[7936] chrome.exe' has exited with code 259 (0x103).
The program '[1900] chrome.exe' has exited with code 259 (0x103).
The program '[8496] chrome.exe' has exited with code 259 (0x103).
The program '[6288] chrome.exe' has exited with code 259 (0x103).
The program '[6616] chrome.exe' has exited with code 259 (0x103).

(但Chrome并未真正退出)但仍在运行

当我在没有调试的情况下启动项目时( Ctrl + F5 ),关闭选项卡似乎对IISExpress没有影响(应用程序继续)

UPDATE3 : 令人惊讶的是,只有在我开始调试之前关闭之前存在的选项卡时才会发生这种情况。创建新选项卡并关闭它们会导致调试器停止。

1 个答案:

答案 0 :(得分:1)

这似乎是IE的默认功能,如果关闭运行应用程序的所有选项卡,则调试器将停止。对于解决方法,我们做了以下一次:

  • 在IIS中托管应用程序,因此无论我们是否调试,应用程序实际上都在运行。
  • 当应用程序运行时,将调试器附加到IIS工作进程(w3wp.exe)。
  • 这可以防止对浏览器的依赖关闭,只要IIS工作进程正在运行,调试器就会保持连接状态。

希望它有所帮助...