Solved

Debug Windows Service program in C#

Posted on 2016-10-01
4
31 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
  • 2
4 Comments
 
LVL 32

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now