sarat
sarat

Reputation: 11110

How to call Windows services created with .NET?

I have a basic windows service which does some conversions of data. There's decoupled GUI which allows user to changes some configuration and this needs to be proprogated to the Windows Serivice running. Both of them are running the same box and implemented using C# .NET. Which is the best way to communicate to the service other than interprocess communication mechanisms like mutex, events etc. Also I'd like to avoid to implement it as a web service because it's not a webservice.

Upvotes: 0

Views: 251

Answers (3)

John Laffoon
John Laffoon

Reputation: 2915

Since you're dealing with configuration data for the service, I would persist it somewhere. Database, file, registry, etc. UI writes the information and the service reads it when appropriate (e.g. each run).

Upvotes: 0

Oded
Oded

Reputation: 498904

If the processes are not going to move to different machines, you can use memory mapped files as the communication mechanism.

If that's not the case, WCF is a good option.

Upvotes: 0

Aliostad
Aliostad

Reputation: 81660

I would use a WCF Service to communicate.

You can use netNamedPipe binding but that might not work on Windows 2008/Windows 7 since the Service runs in session 0 and all user code runs in sessions >0 and they would not be able to communicate.

So I used netTcpBinding in my own project.

Upvotes: 3

Related Questions