Hi guys,
I'm trying to do just this, debug a Windows Service. I tried some ways I
found around the net but I wasn't able to get it to work.
This I found at http://www.codeproject.com/dotnet/DebugWinServices.asp and
seems like a nice approach, but when it talks about "<Your Service's Primary
Method Here>" I don't know what to do... =/
Any help, will gonna be VERY welcome.
//#if (!DEBUG)
// System.ServiceProcess.ServiceBase[] ServicesToRun;
// ServicesToRun = new ServiceBase[] { new Service1() };
// ServiceBase.Run(ServicesToRun);
//#else
// // Debug code: this allows the process to run as a
non-service.
// // It will kick off the service start point, but never
kill it.
// // Shut down the debugger to exit
// Service1 service = new Service1();
// service.<Your Service's Primary Method Here>();
// // Put a breakpoint on the following line to always catch
// // your service when it has finished its work
//
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
//#endif
Thanks,
Charly.
Bryan Phillips - 06 Jun 2007 02:46 GMT
I use this for everything:
#if DEBUG
if (!System.Diagnostics.Debugger.IsAttached){
System.Diagnostics.Debugger.Launch();
}
System.Diagnostics.Debugger.Break();
#endif
--
Bryan Phillips
MCT, MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com
Web Site: http://www.composablesystems.net
> Hi guys,
>
[quoted text clipped - 28 lines]
>
> Charly.
Carlos Sosa Albert - 06 Jun 2007 14:10 GMT
Thanks a lot Bryan, it worked like a charm.
Do you by any chance have some link/idea of documentation about Windows
services? Is the first one I'm working on and I feel a little bit lost... =P
>I use this for everything:
>
[quoted text clipped - 47 lines]
>>
>> Charly.