Microsoft Enterprise Tech Talk – Introduction to WCF

I recently gave an Introductory session on Windows Communication Foundation at Microsoft Innovation Center, Karachi – Pakistan (20th Mar’ 09). Adil

The targeted audience were industry professionals and the goal was to demonstrate them making WCF services. Following was the agenda of the session:

  • Background
  • What is WCF?
  • WCF Service Model
  • Creating a WCF Service
    • Contract
    • Binding
    • Address
  • Hosting ServicesAudience
  • Creating and Invoking WCF Clients
  • Configurable Endpoints
  • Migration and Performance Issues

The session was followed by Q & A in which audience were very keen to ask question related to migration from ASMX to WCF. I shared some of my experience using WCF services with the audience as well.

In collaboration with Microsoft Community Partner, We are soon going to announce another session on “Exploring WCF Features” in which we will see the demo of some features that ship with WCF.

I would like to thank all the participants for their valuable time and interest.

Adil Mughal

WCF Binding Selection

Windows Communication Foundation(WCF) Services exposes endpoint(s) and each endpoint has information of ABC i.e. Address, Binding and Contract.

Binding defines the underlying protocol, message encoding and transport details which are essential for client and service to communicate with each other. WCF provides several pre-configured bindings having different protocols, encoding scheme etc. Further these bindings can be customized. For details, visit “Windows Communication Foundation Bindings” at MSDN.

The WCF ships with the following pre-configured bindings:

Binding

Description

basicHttpBinding

This interoperable binding is commonly used as a replacement for earlier Web services based on ASMX (Active Server Methods). It supports Hypertext Transfer Protocol (HTTP) and Hypertext Transfer Protocol over SSL (HTTPS) transport protocols as well as text and Message Transmission Optimization Mechanism (MTOM) encoding methods.

wsHttpBinding

This secure and interoperable binding uses SOAP over HTTP and supports reliability, transactions, and security over the Internet. It supports HTTP and HTTPS transport protocols as well as text and MTOM encoding methods.

wsDualHttpBinding

This interoperable binding is commonly used for duplex service contracts because it supports bidirectional communication.

webHttpBinding

This secure and interoperable binding sends information directly over HTTP or HTTPS without creating a SOAP envelope. It is an efficient choice when SOAP is not required by the client.

wsFederationHttpBinding

This secure and interoperable binding supports federated security. It supports HTTP and HTTPS transport protocols as well as text and MTOM encoding methods.

netTcpBinding

This secure binding is used to send binary-encoded SOAP messages from one WCF computer to another. It uses Transmission Control Protocol (TCP) and includes support for reliability, transactions, and security.

netNamedPipeBinding

This secure binding should be used on a single WCF computer. Binary-encoded SOAP messages are sent over named pipes.

netMsmqBinding

This queued binding is used to send binary-encoded SOAP messages over MSMQ. Communication should occur between two computers.

netPeerTcpBinding

This secure binding is used for peer-to-peer communication over TCP. Communication should occur between two or more computers.

msmqIntegrationBinding

This interoperable binding can be used for existing MSMQ applications that use COM and native C++ application programming interfaces (APIs).

basicHttpContextBinding

This binding provides support for HTTP cookies and enables SOAP headers to exchange context.

netTcpContextBinding

This secure binding enables SOAP headers to be used in the exchange of content.

wsHttpContextBinding

This secure and interoperable binding enables SOAP headers to exchange context while also supporting reliability, transactions, and security.

*Table Taken from MCTS 70-503 Windows Communication Foundation By Microsoft Press, Copyright GrandMasters and Microsoft Corporation.

Choosing a Binding for WCF Service may seem confusing, initially, for developers but here is a flow diagram that will help you in selecting binding depending upon your scenario.

clip_image001
Reference: Programming WCF Services by Juwal Lovy- Oreilly

Perhaps the most commonly used in the market are basicHttpBinding and wsHttpBinding which uses SOAP 1.1 and SOAP 1.2 respectively. A good comparison of both these is done by Kurt CLAEYS on his blog. I hope this post cleared the picture in your mind 🙂

Have a Good Day with Services!

C# 4.0

After watching the Anders Hejlsberg’s session “The Future of C#” on Channel 9, I’ve got excited to get hands on the upcoming features of C#. Since the inception of C#, each version bought some major changes and amendments in the language. Like, In C# 1.0 the major theme was Managed Code then in C# 2.0, Generics were introduced and lastly in C# 3.0 LINQ was introduced. C# 4.0 introduced the concept of Dynamic Programming in C#. Overall there are four main features that are introduced in upcoming C# 4.0:

  1. Dynamic Typed Objects
  2. Optional and Named Parameters
  3. Improved COM Interoperability
  4. Co- and Contra-Variance

We will explore these features one by one in the upcoming posts. A document related to New Features in C# is available at MSDN that explain all of the above features in a little detail. Plus if you are interested in getting an early look on Visual Studio 2010 CTP, you can follow my post on Visual Studio 2010 CTP.

Have a good time!

Visual Studio 2010 CTP

Greetings!

In order to try out fantastic features in the upcoming C# 4.0, today I downloaded Microsoft Visual Studio 2010 and .NET Framework 4.0 Community Technology Preview (CTP). Microsoft is currently providing Virtual Machine(VM) hard disk to be run on Microsoft Virtual PC SP1. The first look of VS 2010 shows you a new good looking start page built on WPF, which can be customized as well 🙂

There are plenty of features coming in C# 4.0 which we will discuss in the coming posts. For now, If you are interested in getting first look of the upcoming technology you can download it from Visual Studio 2010 CTP Feedback Home. The download size is very large, around 7 GB, make sure you use some download utility for that. There are plenty of tips and suggestions are posted for downloading and using CTP but here I will recommend you to visit following links before using CTP:

http://tinyurl.com/GetCTP
http://tinyurl.com/VSFeedback
http://tinyurl.com/CTPActivation

Also there is also a video available on Channel 9 which will help you in working with the Visual Studio 2010 CTP.