Saturday, July 24, 2010

WCF fundamentals .

Explains what WCF bindings, Address, Contract are to give you a quick know how about WCF terminology

WCF is usefull when you want to build distributed applications, earlier to it there were many different technologies to use like Web Service (Interoperability), Remoting (Speed and only .net to .net), or there were IPC calls that could be made for calls within the same system.

Now if you know web-services, I cannot expect you to know remoting or IPC calls.
So it was quite difficult to know different technologies, for developing a robust distributed systems architecture.

Now what is that WCF is offering that is so attractive ? basically it gives you the flexibility to move your WCF service from local to a remote location in the intranet or  to the internet or vice versa, without even changing a single line of code. This is achieved using a programming model by which the interaction to the service from a client is always consistent whereever the service is...say local, remote or on the net. Even within the same app domain, across app domains or across processes it maintains the same model as shwon below thus giving us the flexibility to move the service anywhere.

Now lets get into programming WCF, the terms and their meanings.

1) Service - The functionality that will be exposed using the WCF service.

2) End Point - An endpoint is defined by three parts (ABC)
     A is Address : WHERE the service will be hosted. ex http://localhost:10001/myService
     B is Binding : HOW to talk to the service, using what transport schemas, security, and many more.
                          There are 9 default bindings (wsHttpBinding, netTcpBinding etc) provided by WCF.
     C is Contract : What is being offered by the Service.

3) ServiceContract :  Technology nuetral way of exposing what the service has to offer. (Usually an interface or class).

4) Service Host :  as the name suggests, host for the Service. WCF service cannot stay in void needs to be hosted (using IIS, WAS, or Self Hosting). So there is a class called ServiceHost provided in the WCF namespace (System.ServiceModel) to host the service in Self Hosting, IIS and WAS will take .SVC files similar to .ASMX files.

Note: A Service can have multiple endpoints specified.

Last but not the least WCF was built completely keeping in mind the Microsoft's vision of SOA.(Not usefull as much initially when learning WCF).

I will keep this post short, but if anyone liked it and wants to go into furthur details of WCF let me know. I will post some more information.


No comments:

Post a Comment