Debug Windows service
-
Hi to all, I have created a windows service which contains Timer control.The Service is being created and running well.I want to debug the code line by line of the service due to some malfunctioning.can any body help me regarding this.Can anybody tell how to debug the code.Hope that there will be someone to help me. Thanks Before answering, S G
-
Hi to all, I have created a windows service which contains Timer control.The Service is being created and running well.I want to debug the code line by line of the service due to some malfunctioning.can any body help me regarding this.Can anybody tell how to debug the code.Hope that there will be someone to help me. Thanks Before answering, S G
Build the application for debugging. Make sure the deployed location of the service application .EXE has the application's debug info file (.PDB) there too. In Visual Studio, go to the Debug menu and choose "Attach to Process...". Adjust the settings in the dialog as necessary and find your running service process in the list of processes. Then click the Attach button. If you do this with the service application project loaded in VS, you can open source files and set breakpoints, or whatever other usual debugging stuff you want to do.
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Build the application for debugging. Make sure the deployed location of the service application .EXE has the application's debug info file (.PDB) there too. In Visual Studio, go to the Debug menu and choose "Attach to Process...". Adjust the settings in the dialog as necessary and find your running service process in the list of processes. Then click the Attach button. If you do this with the service application project loaded in VS, you can open source files and set breakpoints, or whatever other usual debugging stuff you want to do.
Mark Salsbery Microsoft MVP - Visual C++ :java:
Mark, I tried this option, but faced some difficulties with no result. a)Once when i attach that process to my IDE with being set break points at some places,I see something getting debugged(running) in the application,but no stop at that break points. Can u please tell me in detail,how to debug,it will be good enough(PLEASE). I am using VS 2005. Thank u For replying, S G
-
Mark, I tried this option, but faced some difficulties with no result. a)Once when i attach that process to my IDE with being set break points at some places,I see something getting debugged(running) in the application,but no stop at that break points. Can u please tell me in detail,how to debug,it will be good enough(PLEASE). I am using VS 2005. Thank u For replying, S G
S G 1986 wrote:
Can u please tell me in detail,how to debug
I'm not sure what else I can tell you. Those are the steps. Did you put breakpoints on code that has already run when the service started? Once you've attached the debugger to the process, go to the service control manager plugin and stop the service. Does the app stop in the debugger? If not then you haven't attached to the right process. If it does stop the debugger then we can narrow down the problem...
Mark Salsbery Microsoft MVP - Visual C++ :java: