How can I debug C ++ Windows service?

Source: Internet
Author: User

In fact, there is no big difference between debugging C ++ Windows Service and debugging common C ++ console APP/mfc:

  1. After running Windows service, you can select Tools> attach to process to find the service to be debugged in available processes and click attach.

    • If your service is in session 0, you may need to open vs as an administrator to attach.
    • One service can only be associated with one vs attach.
  2. Please ensure that yourCodeIs the latest, that is, the Code is the code that generates the Windows service. Otherwise, the execution result of Windows service may be different from your code.
  3. Code snippets starting with Windows service may not be able to be debugged (because it takes time to attach to the service, but the service runs fast ).
    • However, you can add sleep (30) at the start of service (for example, during initialization ).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.