views:

731

answers:

2

At work, I want to create a WCF Windows Service that runs on a network server. Then I want to create a WPF application that can be installed on various machines on the network. This WPF application needs to be able to communicate with the WCF Windows Service on the network server.

Is this feasible? Is there a better way to accomplish what I want to do? Does anyone know of any resources that show examples of this? I found some tutorials how to setup a WCF service within a Windows service, but I am unsure how to communicate with it over a network.

Thanks for any advice!

+1  A: 

Yes, a WPF application can host a WCF client just as well as (and in the same way as) any other .NET application. You may run into security limitations if your application is packaged as an XBAP for browser delivery, but otherwise it should all just work.

Similarly, a Windows service can host a WCF service. For an example see "How to Host a WCF Service in a Managed Windows Service" at http://msdn.microsoft.com/en-us/library/ms733069.aspx.

You can then communicate with it over the network by creating a client proxy -- the easiest way to do this is to use the Visual Studio Add Service Reference command.

itowlson
A: 

I don't understand your question. You say you saw examples of WCF servers and clients, but you are unsure how to communicate with it over a network. But all of the examples you saw were about the clients and servers communicating over the network!

What's the difference between what you saw in the samples, and what you want to accomplish yourself?

John Saunders
I don't know. Maybe nothing. I'm new to this.
JimDaniel
Ok. WCF services can communicate over a network, or over local communications channels like named pipes. They can use anything from XML over http through binary over TCP/IP. There's no reason that a WCF service couldn't do anything you need it to do.
John Saunders
Can a WCF service hosted with a windows service be accessed over internet?
NLV
@NLV: Yes. A WCF service can be hosted anywhere, with no restrictions on binding.
John Saunders