How to output debug information on program that is a Windows Service

My program is a Windows Service, and I want to
System.Diagnostics.Trace.WriteLine or
System.Diagnostics.Debug.WriteLine.
, but I can't get any string by "DebugView(Sysinternals)".

I think DbgPrint should be used, but how do I with C#




Answer this question

How to output debug information on program that is a Windows Service

  • KingKarter

    hi.,

    To debug windows service.,

    1. Create Setup Project for windows service. Add Project output ( primary output, Debug symbols ) from you windows service project.
    2. Install your service.
    3. Start your service.
    4. In Visual Studio .NET, choose Processes from the Debug menu.

      The Processes dialog box appears.

    5. Click Show system processes.

    6. In the Available Processes section, click the process for your service, and then click Attach.
      Tip The process will have the same name as the executable file for your service.

      The Attach to Process dialog box appears.

    7. Choose any appropriate options, and then click OK to close the dialog box.
      Note You are now in debug mode.
    8. Set any breakpoints you want to use in your code

    I hope you can see Debug output.

    cheers.,

    soemoe



  • How to output debug information on program that is a Windows Service