Display messages, when using windows services
-
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:
-
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:
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....
-
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....
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.
-
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:
Have a look at implementing log4net in your service ... http://logging.apache.org/log4net/index.html[^]
Jammer My Blog | Articles | DMon | SampleSort
-
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....
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.
-
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:
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. -
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....
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