Failed to connect windows.

I have a very simple Windows service developed in vb.net 2008. When I try to debug it by going to tools-> Attach to process, although I see my service, it is disabled and the type is Managed and I cannot select a process.

How to debug my service?

thanks

+5
source share
5 answers

Attaching to the service should work, so I'm not sure why you cannot. Instead, insert the following line into the entry point of the application for your Windows service (or the OnStart () method), compile in debug mode, and start the service.

System.Diagnostics.Debugger.Break();

. Visual Studio 2008, . F5, .

EDIT:

, ( - ) installutil , . , . , . , , exe/dll (s) . , , . , : , . , , .

debug vs. release, , . , , , , , . .

Visual Studio bin\Debug . , bin\Release. installutil , , . (installutil /u c:\myapp\myapp\bin\release\myapp.exe), , , installutil ( bin\Debug ).

, . , .

+10

" Windows" MSDN, . MyNewService.vshost.exe " ", . , BOTH " " " ", . "SYSTEM", , .

( MyNewService.vshost.exe) MyNewService.exe, .

, , . OnPause (, OnContinue), , , CanPauseAndContinue ( , AutoLog).

, 64- . . , , , .

, "" . "MyNewLog" " " , MSDN.

+15

, ? - - servicename.vshost.exe? , , , F5 ( ).

, " ". , servicename.exe, . , .

+3

show processes from all users show processes in all sessions; Select, Managed.

enter image description here

+1

- , , exe , . , Debug = > attach to process visual studio exe, . Visual Studio IDE F5.

If your service is running under a special user account, you will need to use the runas / user command either to start the visual studio if you are debugging the visual studio or from the command line if you start it from the command line.

If that doesn't work ... let me know.

Regards Michael

0
source

All Articles