VISUAL STUDIO 2015 creating Windows Services and debugging

Source: Internet
Author: User

1. New Windows Service Project

2. Add business logic code on Service1.cs

3. After you complete the code, remember to add the installer, or you cannot register as a Windows service

Description Description of the corresponding service, the name of the servicename corresponding service

Account Select LocalSystem

4. Click Create Solution

5, the service program is located in the directory do not have spaces, you can copy the generated program

6. Registering the program with the window service

1) Open command Console, enter CMD after windows+r

2) CD C:\Windows\Microsoft.NET\Framework\v4.0.30319 is the same directory as. NET, different versions of different directories

3) InstallUtil.exe% service directory + Service exe file%. If you uninstall the service, add/U after InstallUtil.exe

Normal words should be visible in Windows services.

7. Start the Windows service

8. Select attach to process in the Debug menu

Select the service process and click Attach.

9 Add Debugger.launch () to the OnStart method; This allows the service to enter the breakpoint immediately after it is started

10 Restart the Windows service to see the debug interface

If you choose Yes, you're going to break.

VISUAL STUDIO 2015 creating Windows Services and debugging

Related Article

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.