Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Console app to communicate with a windows service

Tags:

windows

ipc

we have a windows service running and we also have a console application that we use to configure this service, we also have an option to see some log being recorded.

The very ugly thing with this is that this communication is made by a text file, the console app writes to a text file and the service reads it and vice versa.

What would you use for this communication? TCP/IP is not an option because the console app will be used for the local running service only.

Windows API SendMessage should be the way to go?

thanks!

like image 952
John Avatar asked Jan 29 '10 00:01

John


1 Answers

I would recommend WCF as the first thing to consider for all comms on windows if using .net as its built for this kind of thing and its relatively easy to use. Since you're excluding TCP, I'd suggest using the Named Pipes Binding.

There are also an number of windows comms apis available for intra-machine comms. Named Pipes (as mentioned), MailSlots, Shared Memory (Memory Mapped files) etc.

My suggestion would be be use Named Pipes either with WCF or natively.

like image 58
Preet Sangha Avatar answered Sep 19 '22 21:09

Preet Sangha