Friday, February 13, 2009

WCF Fundamentals

To work with WCF you need to understand these elements in WCF:
1-Addresses
2-Contracts
3-Bindings
4-Hostings
5-Endpoints
6-Metada exchanges
7- Client side Programming

Addresses:
In WCF every service is associated with a unique address. Each address has two specifications. First it has the location of the service and second it has transport protocol. The location has the name of machine, a communication port and an optional specific path called URI. (URI is a unique string). WCF supports these protocols:
· HTTP : we use Http
· TCP : we use net.tcp
· Peer Network : we use net.p2p
· IPC: we use net.pipe
· MSMQ: we use net.msmq

So the address has this format:
[transport protocol]:// [machine name][:optional port number]/[optional URI]
example: Http://myserver:4040/myservice

You use each protocol based on requirement latter on when we talk about binding you will see that there are different bindings and for each binding you need to use one of the protocol then you have different kind of serialization & Interoperable functionality.

WCF & Service Oriented Architecture

Windows Communication Foundation (WCF) is a new technology in .Net 3.0/3.5 helps you to implement Service Oriented Architecture. This new technology not only allows you to work with previous services implemented by .Net Remoting or XML Web Services, but also has extensive functionality like instance management, asynchronous call, transaction management, disconnected queued calls, and security which can be applied through simple configuration.


If you are going to write a service it is better use this technology as it gives lots of flexibility. For those of you who may not work with other technologies like Remoting, COM+ or XML Web Services and may not have experience with Service Oriented Architecture I should say Service Oriented Architecture tries to provide the functionality through services which are components hosted probably in another box. Applications can use these services.

So if you have a code that you think different applications in internet / intranet may use it.You better provide that code as a service then your code centralized in one place while you can use extensive functionality through WCF.

Please read my other posts for WCF comming soon.