How to Debug a Windows Service?

Asked

Viewed 186 times

1

I did a Windows Mail Sending Service every 5 minutes and would like to know how to debug it.

I saw several tutorials on the internet, but could not perform debugging.

Would anyone know how I would debunk the service?

  • 2

    System.Diagnostics.Debugger.Launch();?

  • I put that line in the onstart method of service

  • 1

    If you are using Visual Studio, you can perform an "Attach to Process". Debug->Attach to Process . In the window that will open, check the option to display processes of all users and look for the process of the service you want to debug. Don’t forget to add a breakpoint to the code.

  • I did that and I still don’t debunk...

1 answer

2


I recently also made a service for Windows in C# and used the topshelf. It allows you to develop the service as a console aplication and with that you can debug normally. When your service is ready, you install the file .exe generated by the project as a Windows service.

  • I’ll check, thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.