web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to debug a windows service?

(0) ShareShare
ReportReport
Posted on by

Hi, everyone,

Thank you for helping in advance!

I need to debug a windows service but I don't know how.

I know that in VS: Menu Debug|Attach to the running service’s process, but after I attach to the process, my break point showed: the breakpoint will not currently be hit, no symbols have been loaded for this document.

I know I need to schedule a run of the service, but I don't know how to edit the time in the service's config file to be a few minutes. Or is there other way to do this task?

Thank you again for your time and help!

Best regards

*This post is locked for comments

I have the same question (0)
  • Mahendar Pal Profile Picture
    45,095 on at

    It is better to test your code first on console application, it is very easy to test the logic and once you are fine you can put it under windows service.

  • Verified answer
    Aiden Kaskela Profile Picture
    19,696 on at

    Hi Chris,

    If you need to debug the service as its running and not in a console app, there's great info here:

    [View:https://msdn.microsoft.com/en-US/library/7a50syb3(v=VS.110).aspx:550:50]

    Regarding getting something to run every few minutes, I like to use a Timer to run periodically, and when that elapses to do whatever you need to. To do that:

    - Create Timer on your service.

    - In the OnStart method

    - initialize the timer and set the Interval to your repeat time

    - Add a new event handler to the Elapsed event

    - Set Enabled to true

    - Finally, in your new Elapsed event handler you stop the timer, perform your logic, and re-enable it.

    Hope this helps!

      Aiden

  • Community Member Profile Picture
    on at

    Thank you very much for your help!

  • Community Member Profile Picture
    on at

    thank you very much for your reply! I will try that!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans