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

Debugging a windows service possible without reinstalling for every code change?

3 views
Skip to first unread message

DC

unread,
Jan 21, 2003, 6:47:43 PM1/21/03
to
Hi,

I followed the examples and I do now have a windows service in C# and
I can debug it with the "attach" option. But the whole process is
cumbersome. When I make a change in the code of the service, I have to
build my code, uninstall the current version of the service, build the
install, install the service, start the service, attach to it... takes
forever. Does someone know a shortcut here?

I am also thinking about implementing the windows service as a console
app initially (for easy debugging) and then convert it to a service.
Is this the way to go?

Regards

DC

Dave

unread,
Jan 22, 2003, 6:37:04 AM1/22/03
to

"DC" <d...@upsize.de> wrote in message
news:5b7bac12.03012...@posting.google.com...

> Hi,
>
> I followed the examples and I do now have a windows service in C# and
> I can debug it with the "attach" option. But the whole process is
> cumbersome. When I make a change in the code of the service, I have to
> build my code, uninstall the current version of the service, build the
> install, install the service, start the service, attach to it... takes
> forever. Does someone know a shortcut here?

Can't you just stop the service (net stop svcname), copy the new exe and pdb
over the old one, and restart it?

If you are tired of using the "attach" proccess you can insert the
statements
if ( !System.Diagnostics. Debugger.IsAttached )
System.Diagnostics. Debugger.Launch();
System.Diagnostics. Debugger.Break();
and this will cause it to load an instance of the debugger and break into
your code.

>
> I am also thinking about implementing the windows service as a console
> app initially (for easy debugging) and then convert it to a service.
> Is this the way to go?

That's how I did it under Win32...don't see why you couldn't do that now.
Keep in mind that you will be running under a different account so your
win32 security rights will be different.

>
> Regards
>
> DC


DC

unread,
Jan 23, 2003, 10:18:08 AM1/23/03
to
Hi Dave,

I followed your receips and it works great. Now I just call a batch
that stops the service, copies the new files, starts the service again
and the code will break at the lines you provided (after two message
boxes, but those are not that bad). Thank you.

Regards

DC


"Dave" <kdle...@wi.rr.com> wrote in message news:<eAfcDpgwCHA.2516@TK2MSFTNGP09>...

Dave

unread,
Jan 23, 2003, 8:07:47 PM1/23/03
to
Glad it worked well for you. Take care.
0 new messages