Click here to Skip to main content
15,895,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I am create windows service in visual studio 2012.how to debug code,i mean how to use break point and check line by line ?

I am create service and install with command prompt,i try "Attach to Process" form Debug menu in vs 2012,but nothing happen ,i already place break point in my code and also i use below code at first line of service.
VB
System.Diagnostics.Debugger.Launch()

I set configuration as "Debug" and i stop and start service ,but didn't break point work, so how to debug service in vs 2012,pls give some steps.

Note: i am install service using VS2012 Developer Command Prompt,but still not work.I already try Microsoft documents.

My OS in windows 8.1

Regards

Aravind
Posted
Updated 23-Dec-14 16:02pm
v2

you can attach and debug your service, check How to: Debug Windows Service Applications[^]
also below CP tip give you another way for debugging your service by using console app:
Debugging Windows Services under Visual Studio .NET[^]
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 23-Dec-14 23:09pm    
My 5. At the same time, I developed my own approach which turned out to very efficient (even though it cannot be used to debug all parts of the service). Please see Solution 2.
—SA
DamithSL 23-Dec-14 23:33pm    
Thanks SA
Aravindba 25-Dec-14 21:48pm    
Hi i am try microsoft steps,it will running code in vs2012,but it not hit the break point,i mean if attach process form Debug menu,it automatically run vs 2012,i.e it in debug mode ,but dint hit break point.i am put break point in more than 1 place but still not hit.
In addition to Solution 1:

Debugging of the service can be a relatively difficult problem. I can share my approach I invented, in particular, to ease-up debugging of major part of the service. Please see my past answer: Configure Windows Service with UI[^].

It used to help me a lot. In particular, using my technique, I managed to perform remote debugging of my service controlling industrial hardware in collaboration with 3rd-party suppliers who provides their close-source code and never visited our laboratory.

—SA
 
Share this answer
 
Comments
DamithSL 23-Dec-14 23:33pm    
great, 5wd!
Sergey Alexandrovich Kryukov 23-Dec-14 23:46pm    
Thank you, Damith.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900