Wrox Programmer Forums
|
Visual Studio 2005 For discussing Visual Studio 2005. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 20th, 2007, 12:50 AM
Registered User
 
Join Date: Aug 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default how we debug a windows service?

I made a project of windows service Type ,add installer to project,made a setUp project for it now how I can debug It? will the project automatically add to services in windows?

 
Old October 20th, 2007, 06:51 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

As you are finding, debugging a windows service can be very difficult. In initial development you usually launch the executable from within Visual Studio where you can easily activate breakpoints and debug it. Once it's set up as a service it gets a little trickier.

One option: If you are setting up the service on your development machine, or any machine with Visual Studio for that matter, you can manually attach to the running process from VS. Under Debug->Attach to processes... you can find the process and attach the debugger. This will require the PDB files to be present along side the program's assemblies. Once attached, you can set breakpoints in the code.

Another option: Use a logging library such as log4net. By putting trace statements in your program you can generate very detailed output of the process. The output level can be set to one of I think 5 level within the log4net configuration which is all done in an XML file. lg4net has many output options, one of which is remoting. There is a client app that you can start up to "listen" for your application's tracing messages so you can see in real time what's going on. I haven't used this myself but it sounds very cool.

-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
Impersonate with windows service for Service A/C vinod_yadav1919 C# 0 October 18th, 2008 02:29 PM
Can't Debug Windows App? Ron Howerton Visual Studio 2005 5 November 30th, 2007 05:20 PM
How can i debug my web/windows application? vijaykumartaduri ASP.NET 2.0 Professional 1 March 20th, 2007 06:40 AM
Accessing Windows service from a windows app sajid08 C# 1 October 6th, 2006 10:25 AM
Service debug ahmedfathey .NET Web Services 0 March 31st, 2005 02:30 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.