If you do need to debug the startup of a service with a debugger, there's a way to do that too. Use a conventional exe app to get the binary loaded under the debugger, set breakpoints in service, then use the net start/stop commands to hit them.
You'll need to be swift, as services expect to start in a timely fashion. Mike On Mon, Jul 22, 2013 at 12:06 PM, <[email protected]> wrote: > Found this article… > http://coding.abel.nu/2012/05/debugging-a-windows-service-project/**** > > ** ** > > *From:* [email protected] [mailto: > [email protected]] *On Behalf Of *Greg Keogh > *Sent:* Monday, 22 July 2013 11:58 AM > *To:* ozDotNet > *Subject:* Re: Winforms\WIndows Service**** > > ** ** > > I found some code a while back that allowed me to have an application that > could run as a service or a winform interface…anyone done this before?*** > * > > **** > > If you want the same executable image to be both a Windows Service or a > WinForms app, I've never tried to do that, but perhaps you can different > entry points. One public method will start the message loop, the other > would wire-up to SCM start and stop. It's a bit weird though as services > and forms usually do different things and are used in completely different > ways.**** > > **** > > A more common pattern is to simply write good structured code that > completely isolates the independent "work" and then wrap that in a WinForm > or a service (or a WCF service, or a console command, etc). If you factor > out the "work" you can wrap it in anything convenient.**** > > **** > > Greg**** > -- Meski http://courteous.ly/aAOZcv "Going to Starbucks for coffee is like going to prison for sex. Sure, you'll get it, but it's going to be rough" - Adam Hills
