Windows service with console

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'd like to write a windows service in .net, in itself that's not a big deal,
but my problem comes from the fact that I'd quite like to have the ability to
have a console attached to the service. The reasoning behind it is that I’d
like to have the option of some user input, but if they do something stupid
(namely shutdown the service) it will restart itself and continue, plus it
would be useful to have some screen logging, just the sort of stuff that is
more than I want in the event log (start stop, error) but not the sort of
level of detail that will be in the file logs, which is too much for the
average service engineer to trawl through.

I thought I read somewhere that there was a property along the lines of
HasConsole, but I can’t find it, it what I’m trying possible of do I need to
write a trace listener to listen for information from the service?

Thanks for any help.
Rob
 
don't make sense......
service start at system startup, when no one is even logged.
having a console on the screen at this time when no user is logged would be
a security issue, wouldn't it?

on the other hand you could write your own code where the service listen to
a socket or rmi or shared memory or pipe or MSMQ or whatever.....
 
It could be a security issue, but wouldn't be in this instance, basically we
need all the features of a windows service, (auto start, retstart etc), but
we need to be able to have some sort of console output, ideally that would be
with a console.

I've found the switch in the install utility "/LogToConsole={true|false}",
i'm just a little unsure of how to actually use it.
 
Hi

Yes I have done that with a tray icon....

There is a setting "Allow service to interact with desktop" in the
service properties.

But you can do it in code with

InParam["DesktopInteract"] = true;

in the ProjectInstaller.cs

Regards,

Daniel Roth
MCSD.NEt
 
Back
Top