Solved

Debug Windows Service program in C#

Posted on 2016-10-01
4
44 Views
Last Modified: 2016-10-06
Hello Experts,
I want to Debug a  Windows Service program.  Any idea how can I do that?  When I do it by hitting F5, it works till a point.  After that I get the attached message.  Please help.  Thank you in advance.

Thank you!
DebugWindowsService.png
0
Comment
Question by:RadhaKrishnaKiJaya
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 33

Expert Comment

by:ste5an
ID: 41824988
It depends on the concrete code and situation..

I develop service code as a class library. Thus allows to use unit test and to create a console application to test the code.

Also use a loging framework like EntLib Logging or  log4net. And https://support.microsoft.com/en-us/kb/815788traces are also an option.
0
 

Author Comment

by:RadhaKrishnaKiJaya
ID: 41824996
Hello ste5an,
Thank you!  Do you have any sample code?

Thank you!
0
 
LVL 2

Accepted Solution

by:
Lucas earned 500 total points
ID: 41825639
Hello,

you can follow the instructions given here:
Debugging Tips for Windows Services

in short, you will create a method to test the startup and the stop method of your service, and changing the output type to Console Application.
0
 

Author Closing Comment

by:RadhaKrishnaKiJaya
ID: 41833023
Thank you Lucas.  That worked.
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question