views:

43

answers:

3

I'm writing a windows service to do some daily processing, and I want to have a user-friendly way to interact with it. I'll just be doing basic things like checking its status and viewing logs, though I may decide I want to throw in a function call or two as well. After doing some research, it sounds like I need a separate application to perform these functions, since the service will run independently of any user that's logged into the host machine. My idea is to have this application interact with the service through some kind of interface, but I'm not sure where to begin.

What would be the simplest way to have an application communicate with a separate service? Would I use COM, WCF, a message queue, or something else entirely? I know there are probably a few ways to do this, so I would love to hear some pros and cons if possible.

Edit: The service and the application will both be running on the same machine.

+1  A: 

Ideally you would create a separate application and use WCF to communicate between your service and this application.

But there is a 'cheaper' way which is to implement your own simple Web server using HttpListener. See http://msdn.microsoft.com/en-us/magazine/cc163879.aspx

This makes it easy to accept a few simple commands and you can send them using any web browser.

For viewing logs why not just tail the log files (using e.g. baretail)?

Hightechrider
A: 

Skip WCF, and just use plain .NET Remoting. So much easier. Why they call it deprecated, God knows.

Edit: Seeing it runs on the same PC, the transport would be Named Pipes, IIRC WCF supports this too.

leppie
+1  A: 

Use WCF with NetNamedPipeBinding (allows only IPC on the same machine) or .NET Remoting. If you want to do it quickly choose the technology you are more familiar with. If you are not familiar with any of these technologies choose WCF because it is newer one and you will more probably use it again in the future - so exeprience with it will be useful.

Ladislav Mrnka
Ended up using this. I'm sure I'll have to use WCF more in the future, and seeing as it's more within the spirit of .NET 4.0 I think this is the best option.
Jake