Click here to Skip to main content
15,868,016 members
Articles / Programming Languages / C#
Alternative
Tip/Trick

How to Debug or Test your Windows Service Without Installing it...

Rate me:
Please Sign up or sign in to vote.
5.00/5 (4 votes)
25 Oct 2011CPOL 16.5K   3   4
I am writing a service at present and have written a few over the years. What I do now is put all the code in a separate DLL from the start off. My service methods Onstart, OnStop call into the DLL which starts a thread to do the work.For debugging, I have a separate test harness console app...

I am writing a service at present and have written a few over the years. What I do now is put all the code in a separate DLL from the start off. My service methods Onstart, OnStop call into the DLL which starts a thread to do the work.


For debugging, I have a separate test harness console app that calls into the same startup/stop function the service would. I make this console app my debug instance in the environment and away I go.


Not saying this is a better way than yours, just a different way.


Thanks.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralThanks for your suggesion.... But i think this is more comp... Pin
Tejas Vaishnav1-Nov-11 18:26
professionalTejas Vaishnav1-Nov-11 18:26 
Thanks for your suggesion....

But i think this is more complex way...am i right..or right...?
GeneralRe: Thanks for your suggesion....But i think this is more comp... Pin
atamata24-Aug-12 6:03
atamata24-Aug-12 6:03 
GeneralRe: Thanks for your suggesion....But i think this is more comp... Pin
Strange_Pirate28-Sep-12 2:20
Strange_Pirate28-Sep-12 2:20 
GeneralRe: Thanks for your suggesion....But i think this is more comp... Pin
KeithAMS7-Oct-12 23:40
KeithAMS7-Oct-12 23:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.