Reputation: 2028
Microsoft instructions state the following
In Visual Studio, choose Attach to Process from the Debug menu.
The Processes dialog box appears.
Click Show system processes.
In the Available Processes section, click the process for your service, and then click Attach.
However, I don't see the "Show system processes." option. I've tried checking off the other options but my service doesn't show up in the list.
Yes, I've installed and started the services and can see it in the in service manager.
I'm also aware that It's not possible to debug onstart. However, I have a continuous loop running.
Upvotes: 11
Views: 26489
Reputation: 6923
By default processes not running under your account will be hidden, which is how services run by default unless you set them to run using a custom user.
Make sure show processes from all users is checked:
Upvotes: 0
Reputation: 135
The name of the service might be different with the name of the process. The name of the process is probably the name of the service exe file. you can check this in task manager or in your windows service vs project. (the name that appears in the Attach Process window is the name of the process not the name of the service)
Upvotes: 0
Reputation: 12328
Make sure selected code type settings are correct. You manage them by clicking the [Select...] button next to "Attach to:". In the image you attached, you have set it to "Automatic: Native code". Try some other settings. Note: Press [Refresh] button after you have changed the setting to update the list of processes shown.
Upvotes: 0
Reputation: 22458
You may add somewhere in service, for example in OnStart method this code:
#if DEBUG
System.Diagnostics.Debugger.Launch();
#endif
On service start, you will get a prompt dialog to debug process. Don't forget to build in Debug mode and switch to Release in production
Upvotes: 12
Reputation: 16167
You must do the following:
If the above doesn't work, you will need to provide some additional details about your setup. :-)
Upvotes: 17
Reputation: 9780
Actually to allow the program to get the list of the processes of every user on the machine, that program must have administrative rights. Ensure you start visual studio with the corresponding account.
Upvotes: 0