WCF/WF - how to debuging in windows service in onstart() in .net

Asked By brahma naidu on 02-Apr-13 07:12 AM
Hai I am working with windows service. i have lot of code in on start (). i could't understand what is going on in that code. will u please guide me how to put debugging in that onstart (). thanking you.
Robbe Morris replied to brahma naidu on 02-Apr-13 08:02 AM
The easiest way to work with windows services is to put all of your logic for starting separate threads and the code to execute whatever your service does in a separate assembly.  Then, create a console app to launch it.  You'd adjust your windows service app to use the class in your new assembly as well.  So, all that is in your windows service class is just enough logic to wire up the service and start the logic in your custom class.

This tactic lets you test your window service logic out in any application.  Makes debugging and lots of other stuff easier to manage.