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. Display messages, when using windows services

Display messages, when using windows services

Scheduled Pinned Locked Moved C#
help
7 Posts 7 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.
  • A Offline
    A Offline
    ayandelhi
    wrote on last edited by
    #1

    Hi!! finally i'm working on windows services all thanks to you all and your guidances... The problem is.. how shud i display messages that i wanna see.. since its not using a console anymore console.writeline wont work...:confused: so wat shud i do... :sigh:

    L J G 3 Replies Last reply
    0
    • A ayandelhi

      Hi!! finally i'm working on windows services all thanks to you all and your guidances... The problem is.. how shud i display messages that i wanna see.. since its not using a console anymore console.writeline wont work...:confused: so wat shud i do... :sigh:

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      FYI: Window Service does not have any User Interface. You cannot even give message while running window service. The only way to track status or give message is by using Event Log. Use System.Diagnostics.EventLog namespace and write log entry and do whatever you want using it from window service. HTH

      Jinal Desai - LIVE Experience is mother of sage....

      G L R 3 Replies Last reply
      0
      • L Lost User

        FYI: Window Service does not have any User Interface. You cannot even give message while running window service. The only way to track status or give message is by using Event Log. Use System.Diagnostics.EventLog namespace and write log entry and do whatever you want using it from window service. HTH

        Jinal Desai - LIVE Experience is mother of sage....

        G Offline
        G Offline
        Gonzalo Cao
        wrote on last edited by
        #3

        Another good idea is to have an application that works as a monitor and gets the feedback from the service, since you can use sockets and you can use Window's message queue. Or you can use a smpt client to send e-mails reporting service problems.

        1 Reply Last reply
        0
        • A ayandelhi

          Hi!! finally i'm working on windows services all thanks to you all and your guidances... The problem is.. how shud i display messages that i wanna see.. since its not using a console anymore console.writeline wont work...:confused: so wat shud i do... :sigh:

          J Offline
          J Offline
          Jammer 0
          wrote on last edited by
          #4

          Have a look at implementing log4net in your service ... http://logging.apache.org/log4net/index.html[^]

          Jammer My Blog | Articles | DMon | SampleSort

          1 Reply Last reply
          0
          • L Lost User

            FYI: Window Service does not have any User Interface. You cannot even give message while running window service. The only way to track status or give message is by using Event Log. Use System.Diagnostics.EventLog namespace and write log entry and do whatever you want using it from window service. HTH

            Jinal Desai - LIVE Experience is mother of sage....

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            Jinal Desai - LIVE wrote:

            The only way

            three words to avoid. :)

            Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

            Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

            1 Reply Last reply
            0
            • A ayandelhi

              Hi!! finally i'm working on windows services all thanks to you all and your guidances... The problem is.. how shud i display messages that i wanna see.. since its not using a console anymore console.writeline wont work...:confused: so wat shud i do... :sigh:

              G Offline
              G Offline
              geo_m
              wrote on last edited by
              #6

              I'd not reccommend doing so, better is stick with some nlog or something like this. But if you really really need to, use the MessageBox.Show overload that allows you to specify the: MessageBoxOptions.ServiceNotification The message box is displayed on the active desktop. The caller is a service notifying the user of an event. The function displays a message box on the current active desktop, even if there is no user logged on to the computer. But generally it is considered a bad practice of displaying messagebox directly from the service. I'd stick with some logging solution.

              1 Reply Last reply
              0
              • L Lost User

                FYI: Window Service does not have any User Interface. You cannot even give message while running window service. The only way to track status or give message is by using Event Log. Use System.Diagnostics.EventLog namespace and write log entry and do whatever you want using it from window service. HTH

                Jinal Desai - LIVE Experience is mother of sage....

                R Offline
                R Offline
                Rod Kemp
                wrote on last edited by
                #7

                Jinal Desai - LIVE wrote:

                You cannot even give message while running window service.

                That’s not entirely true, Interactive Sevices[^], so long as you're using XP If you want to send a command to a service you can override the OnCustomCommand[^] method and use the ServiceController.ExecuteCommand[^] method to send the command.

                People are more violently opposed to fur than leather because it's safer to harass rich women than motorcycle gangs

                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