Take the 2-minute tour ×

I am creating a client application that downloads and displays market data from Yahoo! for a university project, but that also sends out notifications to mobiles (so far using Google cloud messaging). So far it's a WPF client and the "server" is a class library - so far working. What I was wondering, is can you mix this server with a WCF service - the WCF service I was planning on using for registering devices, as well as accepting and parsing commands.

So I would call .Start() on my server object, and it will be constantly running in the background, while a WCF REST service runs alongside it - or would I be better simply having a thread running on the server that can accept input... sorry if this is confusing, but just wondering if it can, or has been done before or any advice. :)

Just to explain a bit better

The client front end and the "server" are running on the same machine - I was calling it a server because it is not only updating the front end, but sending out GCM notifications at the same time. I was wondering if maybe a WCF service could be added to make it simpler to handle adding devices to a database ("server" reads a list of device reg ids from a database, sends notifications to these) by allowing an android app to details via REST or something similiar

share|improve this question
You clearly can mix pretty much any type of services/libraries... Is your goal to have communication between processes via REST service or something else? It is unclear what exactly need to be more complex than basic WPF application. –  Alexei Levenkov Jan 9 '13 at 17:20

2 Answers 2

up vote 3 down vote accepted

I would explore wrapping the class library in a Windows Service (which is essentially a process that runs continuously, and can be stopped/started/paused) and keep your WCF service as a web service for client communication.

How the WCF client service communicates with the Windows service is up to you - whether you store the data in a shared database, keep it in memory and have another WCF layer communicating between the two, etc. A shared database would be the most straightforward, especially if you want to persist the data for use by other apps/services as well.

share|improve this answer
Yeah the way its structured now I have WPF app, selected "Start Server" and the server is started from the mainWindowViewModel. When the server gets an update, it triggers an event that sends the data from the class library to the ViewModel, which in turn processes it, updates display etc. No data is persisted really, except user settings and config in a database - the data is stored in a dictionary in the class lib. and kept in memory, at the end its dumped –  SCassidy1986 Jan 9 '13 at 17:35
Based on this, you may simply be best off serializing the dictionary to disk when you close the WPF app, and the re-load it when you start it up. This would solve your immediate problem. For a production system, I would create the WCF Service inside a Windows Service (or a WCF service inside an asp.net app to host in IIS) and then modify your WPF app to use the WCF service methods the same way that the Android devices would. –  Nate Jan 9 '13 at 17:46

WCF Service would be useful if you had one notification service on your server with multiple WPF client application connecting to it. If you have just one application running on the same server then not sure if it will be worth the overhead.

The usual pattern is to host WCF service in IIS, that way it always starts whenever first request is received. WCF is very flexible though, therefore you can host in in Windows Service, Console Application, etc.

share|improve this answer

Your Answer


