views:

31

answers:

2

I have previously built WPF apps that host their own WCF service running on a custom port. Which is a great simple way for other apps to send messages between each other.

I have recently inherited a Silverlight 4 app from a client and they would like a way to send messages to it. I figured that WCF would be a simple way, but it is not possible to host a service in Silverlight.

What is a good, simple, way to send messages/communicate with a Silvelight app?

I have seen a little about the LocalMessageSender but I have no experience with it, can a WPF app, running on a different machine send a message to a Silverlight application using the LocalMessageSender class?

(Polling from the Silverlight app is not a prefered option)

I dont mind having to run the app in out of browser mode to get around some issues if need be.

EDIT Updated question

+1  A: 

You can add Silverlight enabled WCF services and communicate with them like you did in the WPF app.

tchrikch
do i have to run it out of the browser?
Mark
no , it works in the browser mode
tchrikch
the reason I ask is that you must run the WPF app as an administrator, how can a browser plug-in open up a channel at a specific port? If it works, I guess I dont care, but im just curious...
Mark
hmm..actually SL app is hosted inside ASP.NET web site (and so will be this WCF service), so supposing you will deploy it on your IIS server there are no problems to get to the service from outside world, though I'm not sure now whether it's something you are looking for
tchrikch
im a little confused, I want a way to talk to the silverlight app directly from a WPF app, since the silverlight app runs on the client, it needs to create a http channel to allow incoming messages via WCF
Mark
A: 

Hi Mark,

just so you know, SL only supports basicHttpBinding and (new in SL4) netTcpBinding. The later is intended for Intranet scenarios. As tchrikch said, you should be able to reference your service just by adding a simple reference in Visual Studio. As for the communication part, this may prove to be a little difficult. I would suggest looking at HTML5 WebSockets and see if you can push messages to the client from the server that way. I've only recently started looking at this as a solution for one of our projects but haven't had time to look any deeper.

HTH

Steve

Steve
I see, yeah I know how to get communication OUT of SL, just not into it...
Mark