Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Best way to debug a Windows Service

Best way to debug a Windows Service

Scheduled Pinned Locked Moved C#
debugging
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Christiaan Laubscher
    wrote on last edited by
    #1

    Hello I am wondering what the "best" method is to debug a Win - Service. I know about the following two: 1) Writing a Log - file to output the state of variables/ bugs encountered etc. (Very basic I know) 2) Start the service and then attach a debugger to it. (Better !!) 3) Try to debug the code in "Console - mode" If anybody out there has any advice on another way to debug a windows service, then please let me know. Thanking you in advance ChristiaanS :|

    ChristiaanS

    D P 2 Replies Last reply
    0
    • C Christiaan Laubscher

      Hello I am wondering what the "best" method is to debug a Win - Service. I know about the following two: 1) Writing a Log - file to output the state of variables/ bugs encountered etc. (Very basic I know) 2) Start the service and then attach a debugger to it. (Better !!) 3) Try to debug the code in "Console - mode" If anybody out there has any advice on another way to debug a windows service, then please let me know. Thanking you in advance ChristiaanS :|

      ChristiaanS

      D Offline
      D Offline
      dbrenth
      wrote on last edited by
      #2

      There's no rule that says all of the code for a service has to be in the service project. I do everything I need to do in a dll assembly. Then I create a GUI that has a Start button and a Stop button. If it works correctly there, it will work correctly when I wire up OnStart and OnStop in the service. Brent

      Brent

      A T 2 Replies Last reply
      0
      • D dbrenth

        There's no rule that says all of the code for a service has to be in the service project. I do everything I need to do in a dll assembly. Then I create a GUI that has a Start button and a Stop button. If it works correctly there, it will work correctly when I wire up OnStart and OnStop in the service. Brent

        Brent

        A Offline
        A Offline
        Ashfield
        wrote on last edited by
        #3

        Thats about how I do it too. I makes life easier :)

        Bob Ashfield Consultants Ltd

        1 Reply Last reply
        0
        • C Christiaan Laubscher

          Hello I am wondering what the "best" method is to debug a Win - Service. I know about the following two: 1) Writing a Log - file to output the state of variables/ bugs encountered etc. (Very basic I know) 2) Start the service and then attach a debugger to it. (Better !!) 3) Try to debug the code in "Console - mode" If anybody out there has any advice on another way to debug a windows service, then please let me know. Thanking you in advance ChristiaanS :|

          ChristiaanS

          P Online
          P Online
          PIEBALDconsult
          wrote on last edited by
          #4

          I just use 1 and 2.

          1 Reply Last reply
          0
          • D dbrenth

            There's no rule that says all of the code for a service has to be in the service project. I do everything I need to do in a dll assembly. Then I create a GUI that has a Start button and a Stop button. If it works correctly there, it will work correctly when I wire up OnStart and OnStop in the service. Brent

            Brent

            T Offline
            T Offline
            The Nightcoder
            wrote on last edited by
            #5

            Yep... but beware of using stuff in the DLL that won't work in a service. Such as the UI timer component (the server timer component will work, though). Sometimes violations of that rule aren't obvious....

            -- Peter

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups