在安装了远程桌面服务且有多个用户登录的 Windows Server 2008 R2 服务器上,Visual Studio 即时调试器窗口可能会出现在任何 RDP 会话中,但不一定是导致错误的操作的会话。
这些错误发生在使用旧版 VB6 COM 对象和 SQL Server 数据库的 Classic ASP 应用程序中。似乎进程中的错误w3wp.exe
不知道哪个 RDP 用户的浏览器会话发起了导致错误的操作,因此它会随机选择一个 RDP 会话来生成 JIT 调试器窗口。在显示对话框时,Classic ASP 应用程序会冻结,无论他们处于哪个 RDP 会话中,也无论他们是否正在远程访问该应用程序。更糟糕的是,窗口往往会出现下用户的活动窗口。要摆脱这种情况,必须要求计算机上每个有 RDP 会话的人查找 JIT 调试器窗口并将其取消。
有没有办法强制 JIT 调试器窗口出现在特定用户的 RDP 会话中 - 最好是想要调试该过程的用户的会话?
答案1
由于它位于终端服务器和生产服务器上,因此请卸载 Visual Studio。
当您安装 Visual Studio 时,JIT 调试器会自动安装。
我强烈建议使用本地计算机来满足你的编码需求,因为 JIT需要A控制台窗口。
启用或禁用即时调试
您可以从“选项”对话框中启用或禁用即时调试。要启用或禁用即时调试
On the Tools menu, click Options. In the Options dialog box, select the Debugging folder. In the Debugging folder, select the Just-In-Time page. In the Enable Just-In-Time debugging of these types of code box, select or clear the relevant program types: Managed, Native, or
脚本。
To disable Just-In-Time debugging, once it has been enabled, you must be running with Administrator privileges. Enabling Just-In-Time
调试设置注册表项,并且需要管理员权限才能更改该项。
Click OK.
默认情况下,Windows 窗体应用程序具有顶级异常处理程序,如果程序可以恢复,则允许程序继续运行。因此,您必须执行以下附加步骤才能启用 Windows 窗体应用程序的即时调试。要启用 Windows 窗体的即时调试
Set the jitDebugging value to true in the in the system.windows.form section of the machine.config or
应用程序.exe.config文件:
<configuration> <system.windows.forms jitDebugging="true" /> </configuration> In a C++ Windows Form application, you must also set DebuggableAttribute in a .config file or in your code. If you compile
使用 /Zi 而不使用 /Og,编译器会为您设置此属性。但是,如果您想调试非优化的发布版本,则必须自行设置。您可以通过将以下行添加到应用程序的 AssemblyInfo.cpp 文件来执行此操作:
[assembly:System::Diagnostics::DebuggableAttribute(true, true)]; For more information, see DebuggableAttribute.
即使计算机上不再安装 Visual Studio,仍可以启用即时调试。未安装 Visual Studio 时,无法从 Visual Studio 选项对话框中禁用即时调试。在这种情况下,可以通过编辑 Windows 注册表来禁用即时调试。通过编辑注册表来禁用即时调试
In the Start menu, click Run. In the Run dialog box, type regedit, then click OK. In the Registry Editor window, locate and delete the follow registry keys: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug\Debugger HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\DbgManagedDebugger If your computer is running a 64-bit operating system, delete the following registry keys also: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug\Debugger HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\DbgManagedDebugger Take care not to accidentally delete or change any other registry keys. Close the Registy Editor window.
即时调试错误
您可能会看到与即时调试相关的以下错误消息。
An unhandled win32 exception occurred in <program>. Just-In-Time debugging this exception failed with the following error: The logged
用户无权调试崩溃的应用程序。
This message indicates that Just-In-Time debugging failed because you do not have proper access permissions. For information on the
所需权限,请参阅[已过时] 远程调试权限。
Unable to attach to the crashing process. The specified program is not a Windows or MS-DOS program. This error occurs when you try to attach to a process running as another user under Windows 2000. To work around this problem, start Visual Studio, open the Attach to Process dialog box from the Debug menu, and find the process you
在可用进程列表中选择要调试的进程。如果您不知道进程的名称,请查看 Visual Studio 即时调试器对话框并记下进程 ID。在可用进程列表中选择进程并单击附加。在 Visual Studio 即时调试器对话框中,单击否以关闭对话框。
Debugger could not be started because no user is logged on. This error occurs when Just-In-Time debugging tries to start Visual Studio on a machine where there is no user logged onto the
控制台。由于没有用户登录,因此没有用户会话来显示即时调试对话框。
To fix this problem, log onto the machine. Class not registered. This error indicates that the debugger tried to create a COM class that is not registered, probably due to an installation problem. To fix this problem, use the setup disk to reinstall or repair your Visual Studio installation.
从:https://msdn.microsoft.com/library/5hs4b7a6%28v=vs.100%29.aspx