C# Visual Studio (VS2008)、Windows 窗体应用程序中的远程调试
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/396101/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Remote Debugging in Visual Studio (VS2008), Windows Forms Application
提问by Baget
I'm trying to Remote Debugging a Windows Forms Application (C#), but i'm always getting this error:
我正在尝试远程调试 Windows 窗体应用程序 (C#),但我总是收到此错误:
Unable to connect to the Microsoft Visual Studio Remote Debugging Monitor named 'XXX. The Visual Studio Remote Debugger on the target computer cannot connect back to this computer. Authentication failed. Please see Help for assistance.
无法连接到名为“XXX”的 Microsoft Visual Studio 远程调试监视器。目标计算机上的 Visual Studio 远程调试器无法连接回这台计算机。身份验证失败。请参阅帮助以获得帮助。
I tried to config according to the MSDN guides but i was not able to make it work.
我尝试根据 MSDN 指南进行配置,但无法使其正常工作。
My setup:
我的设置:
- Development Computer- XP (x86) that is connected to a domain.
- Test Computer- Vista (x86) that is NOTconnected to a domain.
- I have network connection between the machines.
- I created a local user in the Test computer(user1) with the name of my domain user that I run the Visual Studio (mydomain\user1). setup the same password.
On The Test Computer i'm running "msvsmon.exe"as application (not as services), i'm running it using "runas"command with the user that i have created. (user1):
runas /u:user1 msvsmon.exe
- 开发计算机- 连接到域的 XP (x86)。
- 测试计算机- Vista中(86),其不连接到域。
- 我有机器之间的网络连接。
- 我在测试计算机(user1) 中创建了一个本地用户,其名称为我运行 Visual Studio 的域用户 (mydomain\user1)。设置相同的密码。
在测试计算机上,我将“msvsmon.exe”作为应用程序(而不是服务)运行,我正在使用“runas”命令与我创建的用户一起运行它。(用户 1):
runas /u:user1 msvsmon.exe
Can Someone help me please?
有人能帮助我吗?
Thanks.
谢谢。
采纳答案by Jason
This is how it worked for me:
这对我来说是这样的:
Remote computer: Microsoft Virtual PC, "IHS\RDM" attached to my corporate domain, logged in as jdoe, administrator account.
远程计算机:Microsoft Virtual PC,“IHS\RDM”附加到我的公司域,以 jdoe,管理员帐户登录。
Local computer: Attached to local domain, logged in as jdoe, administrator account.
本地计算机:附加到本地域,以jdoe,管理员帐户登录。
1) remote computer: install rdbgsetup.exe (from Visual Studio 2005\Disk 2\Remote Debugger\x86)
1)远程计算机:安装rdbgsetup.exe(来自Visual Studio 2005\Disk 2\Remote Debugger\x86)
2) Remote computer: RUNAS /user MYDOMAIN\jdoe /netonly msvsmon
2)远程计算机:RUNAS /user MYDOMAIN\jdoe /netonly msvsmon
3) Remote computer: msvsmon->Tools->permissions add user "MYDOMAIN\jdoe" (I have to do this every time I re-start)
3)远程电脑:msvsmon->Tools->permissions 添加用户“MYDOMAIN\jdoe”(我每次重启都要这样)
4) local computer: run msvsmon.
4)本地计算机:运行msvsmon。
5) local computer, msvsmon->Tools->permissions, add object types: "computers", "IHS\RDM"
5)本地计算机,msvsmon->Tools->permissions,添加对象类型:“computers”、“IHS\RDM”
6) local computer, vs2005->debug->attach to process. Transport: Default, Qualifier: jdoe@RDM
6)本地电脑,vs2005->debug->attach to process。传输:默认,限定符:jdoe@RDM
7) Refresh, and voila; a process list!
7)刷新,瞧;一个进程列表!
回答by Michael Burr
Does TESTCOMPUTER\user1
have the same password as mydomain\user1
?
是否TESTCOMPUTER\user1
与密码相同mydomain\user1
?
You can also try running msvsmon.exe
on the target computer instead of the Remote Debugging Service. You can use "Run As..." to run it under various credentials. Once you get things working with msvsmon,exe
you should be able to install (or re-enable) the Remote Debugger Service having it run under those credentials.
您也可以尝试msvsmon.exe
在目标计算机上运行而不是远程调试服务。您可以使用“Run As...”在各种凭据下运行它。一旦你开始工作,msvsmon,exe
你应该能够安装(或重新启用)远程调试器服务,让它在这些凭据下运行。
EDIT:
编辑:
You should be able to use the Permissions property page in msvsmon.exe
to set up the appropriate debugging permissions for your domain user on the target machine:
您应该能够使用 Permissions 属性页msvsmon.exe
为目标机器上的域用户设置适当的调试权限:
回答by Steve Steiner
Gregg Miskely has a blog poston why the service account needs to have admin privileges (when set up that way). One of the points is that the user account, in your case the user on the Test machine, must have privileges for connecting back to the other computer. It sounds like you are hitting a case where the account mydomain\user1 has insufficient privileges to connect to your development computer.
Gregg Miskely 有一篇关于为什么服务帐户需要具有管理员权限的博客文章(当以这种方式设置时)。要点之一是用户帐户,在您的情况下是测试机器上的用户,必须具有连接回另一台计算机的权限。听起来您遇到的情况是帐户 mydomain\user1 没有足够的权限连接到您的开发计算机。
If that doesn't help perusing Gregg's blog posts, sending him mail could help.
如果这对阅读 Gregg 的博客文章没有帮助,给他发送邮件可能会有所帮助。
回答by Baget
The problem that I had is that I had 2 users:
我遇到的问题是我有 2 个用户:
mydomain\user1
mytestmachine\user1
that is not correct (according to Gregg Miskely) i needed to define a local user in my development computer, for example:
这是不正确的(根据 Gregg Miskely 的说法)我需要在我的开发计算机中定义一个本地用户,例如:
mydevcomputer\debug
mytestmachine\debug
with the same password and run the VS2008 and the Debugging Monitor with this user:
使用相同的密码并使用此用户运行 VS2008 和调试监视器:
回答by Baget
So you're a developer and one of your users got an exception, and you want to debug it remotely without closing the exception window, but they're logged on as a different user account. As it turns out, you can debug their application, but it gets tricky.
因此,您是一名开发人员,您的一个用户遇到了异常,您想在不关闭异常窗口的情况下远程调试它,但他们以不同的用户帐户登录。事实证明,您可以调试他们的应用程序,但它变得棘手。
0) You still need matching local accounts on both the remote app machine and the local Visual Studio machine, which means adding an account to the user's computer.
0) 您仍然需要在远程应用程序机器和本地 Visual Studio 机器上匹配本地帐户,这意味着向用户的计算机添加一个帐户。
1) You need to use runas with the /netonly option. Open a command prompt to the folder where msvsmon is and type
1) 您需要使用带有 /netonly 选项的 runas。打开命令提示符到 msvsmon 所在的文件夹并键入
runas /user:[user] /netonly msvsmon
This causes msvsmon to use the user's credentials only when accessing the network (e.g. when msvsmon connects back to the local VS machine). msvsmon will get upset if you call it with runas without using /netonly.
这会导致 msvsmon 仅在访问网络时使用用户的凭据(例如,当 msvsmon 连接回本地 VS 机器时)。如果您使用 runas 调用它而不使用 /netonly,则 msvsmon 会感到不安。
2) You need to add permissions for the local Visual Studio machine to connect the remote application machine, via the Remote Debug Monitor's Tools->Permissions menu.
2)您需要为本地Visual Studio机器添加权限以连接远程应用程序机器,通过Remote Debug Monitor的Tools->Permissions菜单。
回答by ajs410
So I can't reply without an account, and I can only reply to my own comments, but my registered account is separate from the anonymous account I posted from, so this has to be a "new answer". Sorry.
所以没有账号就没法回复,只能回复自己的评论,但是我注册的账号和发帖的匿名账号是分开的,所以这得是个“新回答”。对不起。
baget - when I made this work earlier today, I created a local account on both the Remote Debug Monitor PC and Visual Studio PC. RDM was not on the domain, VS was. Both local accounts are administrator with credentials identical to my domain account. From a different account (also administrator) I called runas from an elevated prompt with the netonly switch. You may or may not need to provide your domain with the username, but since the passwords should all match I don't think it matters much.
baget - 当我今天早些时候完成这项工作时,我在远程调试监视器 PC 和 Visual Studio PC 上创建了一个本地帐户。RDM 不在域上,VS 在域上。两个本地帐户都是管理员,凭据与我的域帐户相同。我从另一个帐户(也是管理员)使用 netonly 开关从提升的提示中调用了 runas。您可能需要也可能不需要为您的域提供用户名,但由于密码应该全部匹配,我认为这并不重要。
Don't forget to adjust your permissions in the RDM to allow the user account running VS to connect with Debug privileges. It's pretty picky about who it lets you add to the list, so if you don't create the local account first you'll get pretty frustrated. And if you're running RDM under a different user account name, you have to use the full server name when trying to attach to the remote computer; if you run both RDM and VS from the same user account then you can get away with just the computer name.
不要忘记在 RDM 中调整您的权限,以允许运行 VS 的用户帐户以 Debug 权限连接。它允许您将谁添加到列表中非常挑剔,因此如果您不先创建本地帐户,您会感到非常沮丧。如果您在不同的用户帐户名下运行 RDM,则在尝试连接到远程计算机时必须使用完整的服务器名称;如果您从同一个用户帐户运行 RDM 和 VS,那么您可以只使用计算机名称。