详细说明见MSDN:
https://msdn.microsoft.com/en-us/library/7a50syb3(v=vs.110).aspx
- Build your service in the Debug configuration.
- Install your service. For more information, see How to: Install and Uninstall Services.
- Start your service, either from [Services Control Manager], [Server Explorer], or from code. For more information, see How to: Start Services.
- Start Visual Studio with administrative credentials so you can attach to system processes.
- (可选) On the Visual Studio menu bar, choose [Tools], [Options]. In the [Options] dialog box, choose [Debugging], [Symbols], select the [Microsoft Symbol Servers] check box, and then choose the OK button.
- On the menu bar, choose Attach to Process from the Debug or Tools menu. (Keyboard: Ctrl+Alt+P)
The Processes dialog box appears. - Select the [Show processes from all users] check box.
- In the [Available Processes] section, choose the process for your service, and then choose [Attach].
- Choose the appropriate options, and then choose OK to close the dialog box.
- Set any breakpoints you want to use in your code.
- Access the Services Control Manager and manipulate your service, sending stop, pause, and continue commands to hit your breakpoints. For more information about running the Services Control Manager, see How to: Start Services. Also, see Troubleshooting: Debugging Windows Services.
924

被折叠的 条评论
为什么被折叠?



