Click here to Skip to main content
15,895,799 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Dear ALL

I use a windows service application to call DLL project.
I want to do single-step debugging.
How to debug DLL project use a windows service application?
When I select Configuration properties->Debug->Command,browse to the windows service application,
then press F5 to start Service application,Visual Studio shows error.
(Windows Service Applications is start from Services Control Manager, from Server Explorer).
When I start Windows Service Application from Services Control Manager,
the breakpoint of DLL project can not hit.

SQL
Any help is appreciated.Thanks.

Best Regard

s
Posted
Comments
Sergey Alexandrovich Kryukov 6-Mar-14 22:24pm    
There is no such concept, "call a project".
—SA
zhouchengjun 6-Mar-14 22:37pm    
Sorry call DLL API

You can attach the debugger to the service and put a breakpoint on the service entry code.
How to: Debug Windows Service Applications should help you in debugging a service.
 
Share this answer
 
Comments
zhouchengjun 6-Mar-14 22:32pm    
Thanks.
But I need to debug the DLL project,not the service.
The breakpoint is in DLL project.
Sergey Alexandrovich Kryukov 7-Mar-14 0:05am    
Well, yes, I see what you mean. 5, but you see, the question was about debugging a DLL.
Maybe be OP first need to embrace the idea of unit testing.
And I have my own approach to debugging services not covered here: a dual-mode application which runs both interactively and as service, without modifications. Very effective.
—SA
The best way to debug a DLL is not using service. DLL is used as a library. You should better write some debug project for testing the DLL. This is much, much simpler than debugging the service application (if you mean a Windows Service). Debugging of Service Application is a special issue, there are different approaches which may require whole article to describe.

If the execution is not stopping at a break point, check up all settings and make sure that debug information is enabled, re-build the project. The other reason could be this: the break point is never reached in your debug session. To isolated different problems, add a break point to the line of code which will be reached for sure, not matter what happens. Then try to figure out where your execution goes and where it doesn't. This and many, many other techniques contribute to debugging skills, very important in development.

—SA
 
Share this answer
 
Comments
zhouchengjun 6-Mar-14 22:38pm    
“The best way to debug a DLL is not using service.”
That is to say, debug DLL project use a windows service application can not be realize?
Sergey Alexandrovich Kryukov 6-Mar-14 23:35pm    
Why not? I don't think you can see a point. The question was not about debugging the service, it was about testing the DLL. Service using DLL is not helping debugginh DLL, only makes is difficult, hence — debugging using some testing project is better. When DLL is fully debugged, no need to debug it more. If you need to debug the service application itself, it will be a different story. In practice, the words "debug a DLL using a service" is just nonsense.
—SA
zhouchengjun 7-Mar-14 0:56am    
Thank you FOR your help.
SA.
Abhinav S 6-Mar-14 23:45pm    
My 4 this time. Some links to help the OP understand would be useful.
Sergey Alexandrovich Kryukov 7-Mar-14 0:02am    
Yes, it might need more detail. It's just not so easy to cover it on the next level of detail in one quick answer.
Thank you.
—SA
Thanks.
But I need to debug the DLL project,not the service.
The breakpoint is in DLL project.
 
Share this answer
 

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