tags:

views:

670

answers:

4

I understand to an extent that it helps applications communicate regardless of their location. Can some please shed some more light and give an example of a real world use of WCF?

Thanks guys

+12  A: 

WCF is a generic communication mechanism that allows you to setup generic client/host communication between two parties. The neat thing about WCF is that is allows you to configure service properties such as transport (http/pipes/tcp/Tibco EMS), security models (any of the W3C standards), compression, encoding, timeouts, etc, without changing ANY code. That is powerful. Best of all, you can configure it so that you can have a service in C# and a client in Java (or any other language or the other way around), as long as they both talk using the same mechanisms.

You can create a standard HTTP SOAP web service using WCF and one day decide to switch it to use the faster named pipes for local communication. You can create web services that talk over TibcoEMS and have easy failover on the queue level. You can create a file streaming web service that distributes all kinds of images/videos to your application.

siz
Hey siz, thanks for the explaination it is clarifying things.
simplyme
Very excellent overview. +1
Randolpho
A: 

There are a number of reasons why it is advantageous over classic asmx services.

A couple of these off the top of my head are:

  1. The ability to have multiple bindings for the same service call means the message doesn't have to serialise into xml and back if you simply want to communicate inside a web farm.

  2. The way contracts are defined is much more forgiving when it comes to multiple versions of the same contract.

Chris Simpson
A: 

Essentially the use case is where you want two separate applications to talk to each other somehow and their locations are unknown (could be same machine (but different AppDomain), same network or on the other side of the internets)

You can easily embed it into a WinForm app. That was a nice thing to discover. So much easier than .NET Remoting too.

Quibblesome
Hmm, good one, cheers fella.
simplyme
+2  A: 

There's little to add to the responses so far, especially the one from "siz".

One thing to add is that WCF is the current way to do web services on the .NET platform. It's not the "new" way, it's the current way. ASMX web services are the old and just barely maintained way. One Microsoft employee has publicly stated that only critical security fixes will be made to the ASMX platform, so if you intend for your services to be useful more than a year from now, don't use ASMX.

In addition to the typical "web service" use cases, WCF handles atypical cases, like binary communication over named pipes, message queues, etc. To a very large extent, the service you write to support something simple like SOAP over SSL can also support these other protocols, with no changes to the code.

John Saunders
Very good explaination, thanks John
simplyme