Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Remote Debugging a service

I'm trying to remote debug a service using visual studio 2005.

When I run msvsmon.exe as an application, I get the UI and I can change it to noauth and anyuser, then when i try to attach to the process from visual studio remotely, i get an erro saying that it can't attach to a process being run in a session that msvsmon.exe isn't running in. The session of the service is 0.

So I can successfully run msvsmon.exe as a service, but I can't set it up to be in /noauth and /anyuser mode.

The binPath for the service is: "c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Remote Debugger\x86\msvsmon.exe" /service msvsmon90

both /noauth and /anyuser are the commandline switches for msvsmon.

Filling out the 'start parameters' in the service properties window doesn't affect anything.

changing the binPath of the service to:

"c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Remote Debugger\x86\msvsmon.exe" /service msvsmon90 /noauth /anyuser

also does not work (as the service fails to start properly).

How do i get the remote debugging monitor to run as a service in noauth and anyuser mode?

like image 372
Bob Avatar asked Jul 18 '11 23:07

Bob


People also ask

How do I debug a service in Visual Studio?

Start Visual Studio with administrative credentials so you can attach to system processes. (Optional) On the Visual Studio menu bar, choose Tools, Options. In the Options dialog box, choose Debugging, Symbols, select the Microsoft Symbol Servers check box, and then choose the OK button.

How do I debug a .NET service?

Start the service (you can use net start , or start it in the Services window). You should see a dialog box like the following: Select Yes, debug <service name>. In the Just-In-Time Debugger window, select the version of Visual Studio you want to use for debugging.

How do I debug a remote code in Visual Studio?

Set a breakpoint on the line you want to inspect in the debugger. The declaration of the PORT variable is an excellent place to start. Next, go to the Run and Debug menu in the sidebar and select Run script: start. This will execute the application in the remote environment and attach the Node debugger.

How do I debug a Windows service without installing?

The original generated Main() is like the one below. To debug without installing, add the code as follow, mainly #if (! DEBUG). You will be able to step through the code when you run the Windows Service without installing.


1 Answers

Not sure if this would work for you, but have you tried using psexec (from sysinternals) to run msvsmon interactively on session 0?

The command-line would be something like this (from an elevated command-prompt):

psexec –sd –i 0 "c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Remote Debugger\x86\msvsmon.exe" /noauth /anyuser

I'm doing something similar to debug some code when logging off of Windows.

like image 176
David Paxson Avatar answered Oct 12 '22 23:10

David Paxson