in Education by
Is there an easier way to step through the code than to start the service through the Windows Service Control Manager and then attaching the debugger to the thread? It's kind of cumbersome and I'm wondering if there is a more straightforward approach. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
If I want to quickly debug the service, I just drop in a Debugger.Break() in there. When that line is reached, it will drop me back to VS. Don't forget to remove that line when you are done. UPDATE: As an alternative to #if DEBUG pragmas, you can also use Conditional("DEBUG_SERVICE") attribute. [Conditional("DEBUG_SERVICE")] private static void DebugMode() { Debugger.Break(); } On your OnStart, just call this method: public override void OnStart() { DebugMode(); /* ... do the rest */ } There, the code will only be enabled during Debug builds. While you're at it, it might be useful to create a separate Build Configuration for service debugging.

Related questions

0 votes
    Is there an easier way to step through the code than to start the service through the Windows Service ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    Is there an easier way to step through the code than to start the service through the Windows Service ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    Is there an easier way to step through the code than to start the service through the Windows Service ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    I need to change the credentials of an already existing Windows service using C#. I am aware of two ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 17, 2022 in Education by JackTerrance
0 votes
    I need to change the credentials of an already existing Windows service using C#. I am aware of two ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 17, 2022 in Education by JackTerrance
0 votes
    I have created a set of multi-platform C++ components to load and manage various types of digitally signed ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Is there any simple way to repeat code in a try/catch block after an exception occurs without using method ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 1, 2022 in Education by JackTerrance
0 votes
    When I run the following test in Gallio's Icarus it passes, but when I step into it using ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 5, 2022 in Education by JackTerrance
0 votes
    So, I started learning to code in Python and later Django. The first time it was hard looking at tracebacks and ... your Django code? Select the correct answer from above options...
asked Feb 4, 2022 in Education by JackTerrance
0 votes
    App needs to run on the .Net Compact Framework v.3.5. Video can be any format, but I do need ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 12, 2022 in Education by JackTerrance
0 votes
    Which conversion is easier, “Bitmap to Vector” or “Vector to Bitmap”? Give reasons. Select the correct answer from above options...
asked Dec 6, 2021 in Education by JackTerrance
0 votes
    Which conversion is easier, “Bitmap to Vector” or “Vector to Bitmap”? Give reasons. Select the correct answer from above options...
asked Dec 5, 2021 in Education by JackTerrance
0 votes
    Which conversion is easier, “Bitmap to Vector” or “Vector to Bitmap”? Give reasons. Select the correct answer from above options...
asked Nov 26, 2021 in Education by JackTerrance
0 votes
    I have a user interface in .net which needs to receive data from a server, on a request/reply/ ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 27, 2022 in Education by JackTerrance
0 votes
    Why we need One Way Service?...
asked Apr 2, 2021 in Education by JackTerrance
...