Tuesday, October 21, 2008

WCF overview

WCF(Web Communication Foundation) technology is using multiple layer in configuring web service. The three main layers are

1. Address - to specify where is your web service is

2. Binding - to specify how we are going to connect to the web service. For example, using http or https or tcp. Whether we want to use X509Certificate or we want to use Windows Authentication or NTLM or Keboros. And what's is the file upload/download behavior etc

3. Contracts - This is where you write functions for web services. This is the business logic area where you write all your coding based on business logic.

People refers these three layers as A(Address), B(Binding) and C(Contracts) of WCF.

The Address and Binding can be specify either in the coding or in web.config file. The best practise is to specify the Address and Binding in web.config file. The reason is simple. The address and binding can be keep changing based on IT infrastructure requirement and configuration. If we specify the address and binding, when we change the web service hosting environment we have to change the configuration inside the coding and re-compile and re-deploy which is actually quite tedious. If you configure everything in web.config, the moment you need to make changes to the web service address, or certificate or authentication all you need to do is just open up web.config file and make the changes. There is no need to re-compile the code at all.

Other advantage of WCF is it's interoperability. WCF can communicate better with other Web Service technologies like Java, Message Queue, Remote Hosting, COM + etc.

No comments: