Best way to debug a Windows Service
-
Hello I am wondering what the "best" method is to debug a Win - Service. I know about the following two: 1) Writing a Log - file to output the state of variables/ bugs encountered etc. (Very basic I know) 2) Start the service and then attach a debugger to it. (Better !!) 3) Try to debug the code in "Console - mode" If anybody out there has any advice on another way to debug a windows service, then please let me know. Thanking you in advance ChristiaanS :|
ChristiaanS
-
Hello I am wondering what the "best" method is to debug a Win - Service. I know about the following two: 1) Writing a Log - file to output the state of variables/ bugs encountered etc. (Very basic I know) 2) Start the service and then attach a debugger to it. (Better !!) 3) Try to debug the code in "Console - mode" If anybody out there has any advice on another way to debug a windows service, then please let me know. Thanking you in advance ChristiaanS :|
ChristiaanS
There's no rule that says all of the code for a service has to be in the service project. I do everything I need to do in a dll assembly. Then I create a GUI that has a Start button and a Stop button. If it works correctly there, it will work correctly when I wire up OnStart and OnStop in the service. Brent
Brent
-
There's no rule that says all of the code for a service has to be in the service project. I do everything I need to do in a dll assembly. Then I create a GUI that has a Start button and a Stop button. If it works correctly there, it will work correctly when I wire up OnStart and OnStop in the service. Brent
Brent
-
Hello I am wondering what the "best" method is to debug a Win - Service. I know about the following two: 1) Writing a Log - file to output the state of variables/ bugs encountered etc. (Very basic I know) 2) Start the service and then attach a debugger to it. (Better !!) 3) Try to debug the code in "Console - mode" If anybody out there has any advice on another way to debug a windows service, then please let me know. Thanking you in advance ChristiaanS :|
ChristiaanS
I just use 1 and 2.
-
There's no rule that says all of the code for a service has to be in the service project. I do everything I need to do in a dll assembly. Then I create a GUI that has a Start button and a Stop button. If it works correctly there, it will work correctly when I wire up OnStart and OnStop in the service. Brent
Brent
Yep... but beware of using stuff in the DLL that won't work in a service. Such as the UI timer component (the server timer component will work, though). Sometimes violations of that rule aren't obvious....
-- Peter