Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to debug a Window Service Application

    • 0
    • 1
    • 2
    • 0
    • 0
    • 0
    • 0
    • 0
    • 168
    Comment on it

    Window Service: Debugging

       I have discussed about the windows service in my previous blog. (Please visit the following link for reference).

    http://findnerd.com/list/view/Window-Service/3689/

     As I discussed in my earlier blog, that Window Service do not have any user interface and run in the background, therefore it can not be debugged like other windows applications.

    Here I will discuss about, how to debugg a window service:

    Step 1: Open the Visual Studio in Administrator mode.

    Step 2: Open the Window Service Application in Visual Studio.

    Step 3: Now run the command services.msc, you will get the list of all the services installed,
                     Select your service and click start.

    Step 4: Now go back to the Window service application in the visual studio and click on Tools and select the
                      Attach To Process option.

    Step 5: Now a window appears with the whole list of processes/services, select your service and
                     click Attach.

    Step 6: Now the debugger is attached to your Window Service.

    Note:--> As the service has been started first and then the debugger is attached, therefore we cannot debugg the service from OnStart() method. So, inorder to debugg from start use some time delay function such as timer() or sleep() .

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: