Remote Debugging in Visual Studio (VS2008), Windows Forms Application

前端 未结 6 963
半阙折子戏
半阙折子戏 2021-01-30 17:35

I\'m trying to Remote Debugging a Windows Forms Application (C#), but i\'m always getting this error:

Unable to connect to the Microsoft Visual Studi

相关标签:
6条回答
  • 2021-01-30 17:46

    Does TESTCOMPUTER\user1 have the same password as 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.

    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:

    http://msdn.microsoft.com/en-us/library/ms164722.aspx

    0 讨论(0)
  • 2021-01-30 18:00

    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.

    Local computer: Attached to local domain, logged in as jdoe, administrator account.

    1) remote computer: install rdbgsetup.exe (from Visual Studio 2005\Disk 2\Remote Debugger\x86)

    2) Remote computer: 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)

    4) local computer: run msvsmon.

    5) local computer, msvsmon->Tools->permissions, add object types: "computers", "IHS\RDM"

    6) local computer, vs2005->debug->attach to process. Transport: Default, Qualifier: jdoe@RDM

    7) Refresh, and voila; a process list!

    0 讨论(0)
  • 2021-01-30 18:01

    The problem that I had is that I had 2 users:

    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:

    mydevcomputer\debug
    mytestmachine\debug
    

    with the same password and run the VS2008 and the Debugging Monitor with this user:

    0 讨论(0)
  • 2021-01-30 18:02

    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.

    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.

    0 讨论(0)
  • 2021-01-30 18:04

    Gregg Miskely has a blog post on 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.

    If that doesn't help perusing Gregg's blog posts, sending him mail could help.

    0 讨论(0)
  • 2021-01-30 18:07

    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.

    1) You need to use runas with the /netonly option. Open a command prompt to the folder where msvsmon is and type

    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.

    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.

    0 讨论(0)
提交回复
热议问题