Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do you debug a Windows service program?

0 views
Skip to first unread message

Peter Hamilton-Scott

unread,
Nov 4, 2002, 3:08:28 PM11/4/02
to
Is it possible? How?


Brian Mitchell

unread,
Nov 4, 2002, 3:43:38 PM11/4/02
to
I don't think it's possible, but when I create a service I code, and debug
it in a Console Application. Once everything is working, I just copy the
classes to a Windows Service and compile there.

"Peter Hamilton-Scott" <hamscott@DELETE_WHEN_REPLYINGpavilion.co.uk> wrote
in message news:3dc6d3be$0$14288$afc3...@news.easynet.co.uk...
> Is it possible? How?
>
>


Noel Austin

unread,
Nov 5, 2002, 12:40:53 PM11/5/02
to
"Peter Hamilton-Scott" <hamscott@DELETE_WHEN_REPLYINGpavilion.co.uk> wrote in message news:<3dc6d3be$0$14288$afc3...@news.easynet.co.uk>...
> Is it possible? How?

From my research VS can't start a service on its own, however, you can
attach the Visual Studio debugger to the process after the service has
been started. Follow these steps:

1 - Open the project for the service in Visual Studio
2 - start the service using the Windows Services Management console.
3 - In VS click on Debug | Processes...
4 - Find the name of the process running your service and click the
Attach button

You can put some delay logic into the service or have it wait on
some other trigger until you get the debugger attached depending on
what you need to debug.

For my service I also used the class approach, this really speeds
up development time because you can imagine the time you add by having
to install the each new version of the service, start the service,
start the debugger, then start debugging. With the class approach you
just get you classes working in a regular console or windows VB app
and then put them inside of a service application shell for the final
testing.


Noel

Peter Hamilton-Scott

unread,
Nov 5, 2002, 12:48:32 PM11/5/02
to
Thanks Brian, that's pretty much how I thought I'd have to do it.

"Brian Mitchell" <Magel...@hotmail.com> wrote in message
news:eDH$$LEhCHA.2308@tkmsftngp12...

0 new messages