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. Visual Basic
  4. How to debug a Service in VB.NET?

How to debug a Service in VB.NET?

Scheduled Pinned Locked Moved Visual Basic
questioncsharpdebuggingtools
3 Posts 2 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.
  • M Offline
    M Offline
    Matt Philmon
    wrote on last edited by
    #1

    I've written a simple service in VB.NET and it's almost working right... almost. I need to debug it to see what's going wrong but I can't seem to work out how... You have to start the darned thing using that InstallUtil.exe and then start it through Services under Administrative Tools... but how do I connect to it and debug it?

    Z 1 Reply Last reply
    0
    • M Matt Philmon

      I've written a simple service in VB.NET and it's almost working right... almost. I need to debug it to see what's going wrong but I can't seem to work out how... You have to start the darned thing using that InstallUtil.exe and then start it through Services under Administrative Tools... but how do I connect to it and debug it?

      Z Offline
      Z Offline
      Zyxil
      wrote on last edited by
      #2

      ah, i can help you here you have to start your service and then use the Debug > Processes... menu option to attach to your service, at that point you will be in debug mode in vs.net a couple of points/warnings: - to stop debugging, STOP the service from the services control panel applet instead of using the stop debug action in vs.net, otherwise you will have to uninstall your service and reboot your machine X| in order to reinstall it again. when you stop the service properly, vs.net will exit debug mode gracefully - you only get 30 seconds from the time you start your service to attach and debug the OnStart() method,, use the application log to log debug messages, it's much easier than racing to attach to the process,, servicebase has an applicationlog method for this (logmessage() i think) - this is cool: once your service has been installed with installutil.exe, you can stop the service, make code changes, recompile the service and start it again without uninstalling and reinstalling it iv'e been thinking of writing an article for writing a service in .net, but i haven't gotten around to it yet ;) -John

      M 1 Reply Last reply
      0
      • Z Zyxil

        ah, i can help you here you have to start your service and then use the Debug > Processes... menu option to attach to your service, at that point you will be in debug mode in vs.net a couple of points/warnings: - to stop debugging, STOP the service from the services control panel applet instead of using the stop debug action in vs.net, otherwise you will have to uninstall your service and reboot your machine X| in order to reinstall it again. when you stop the service properly, vs.net will exit debug mode gracefully - you only get 30 seconds from the time you start your service to attach and debug the OnStart() method,, use the application log to log debug messages, it's much easier than racing to attach to the process,, servicebase has an applicationlog method for this (logmessage() i think) - this is cool: once your service has been installed with installutil.exe, you can stop the service, make code changes, recompile the service and start it again without uninstalling and reinstalling it iv'e been thinking of writing an article for writing a service in .net, but i haven't gotten around to it yet ;) -John

        M Offline
        M Offline
        Matt Philmon
        wrote on last edited by
        #3

        Thanks! I actually worked it out yesterday on my own but you gave some good points. Thanks for the help!

        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