Avatar of RadhaKrishnaKiJaya
RadhaKrishnaKiJaya
 asked on

Debug Windows Service program in C#

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
.NET ProgrammingC#

Avatar of undefined
Last Comment
RadhaKrishnaKiJaya

8/22/2022 - Mon
ste5an

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.
RadhaKrishnaKiJaya

ASKER
Hello ste5an,
Thank you!  Do you have any sample code?

Thank you!
ASKER CERTIFIED SOLUTION
Lucas

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
RadhaKrishnaKiJaya

ASKER
Thank you Lucas.  That worked.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23