Windows Communication Foundation (WCF) Introduction
**
**
WCF Introduction
Windows Communication Foundation (WCF) is a framework for building service-oriented applications. Using WCF, you can send data as asynchronous messages from one service endpoint to another. A service endpoint can be part of a continuously available service hosted by IIS, or it can be a service hosted in an application.
WCF = WebService + .Net Remoting + MSMQ + COM+
Scenarios where WCF must be used:
A secure service to process business transactions.
A service that supplies current data to others, such as a traffic report or other monitoring service.
A chat service that allows two people to communicate or exchange data in real time.
A dashboard application that polls one or more services for data and presents it in a logical presentation.
Exposing a workflow implemented using Windows Workflow Foundation as a WCF service.
A Silverlight application to poll a service for the latest data feeds.
Features of WCF
- Service Orientation
- Interoperability
- Multiple Message Patterns
- Service Metadata
- Data Contracts
- Security
- Multiple Transports and Encodings
- Reliable and Queued Messages
- Durable Messages
- Transactions
- AJAX and REST Support
- Extensibility
The advantages of WCF
WCF can be configured to work independently of SOAP and use RSS instead.
WCF is one of the fastest communication technologies and offers excellent performance compared to other Microsoft specifications.
To improve communication, transmission speed needs to be optimized. This is done by transmitting binary-coded XML data instead of plain text to decrease latency.
Object life-cycle management and distributed transaction management are applicable to any application developed using WCF.
WCF uses WS specifications to provide reliability, security and transaction management.
Messages can be queued using persistence queuing. As a result, no delays occur, even under high traffic conditions.
Now we will learn the basics of WCF:
The following are the ABCs of Windows Communication Foundation:
"A" stands for Address: as expressed in the wsdl:service section and links wsdl:binding to a concrete service endpoint address.
"B" stands for Binding: as expressed in the wsdl:binding section and binds a wsdl:portType contract description to a concrete transport, an envelope format and associated policies.
"C" stands for Contract: as expressed in the wsdl:portType, wsdl:message and wsdl:type sections and describes types, messages, message exchange patterns and operations.
Address
The address specifies the location of the service that will be exposed for clients that will use it to communicate with the service. The address's protocol that WCF can provide:
- HTTP
- TCP
- NamedPipe
- Peer2Peer
- MSMQ
Binding
Specifies how a service is accessible. In other words, how the two parties will communicate in terms of transport (HTTP, TCP, NamedPipe, Peer2Peer, MSMQ), encoding (text, binary and so on) and protocols (like transactional support or reliable messaging).
The following are the Bindings supported by WCF 4.0:
- basicHttpBinding
- wsHttpBinding
- wsDualHttpBinding
- wsFederationHttpBinding
- netTcpBinding
- netNamedPipeBinding
- netMsmqBinding
- netPeerTcpBinding
- msmqIntegrationBinding
- basicHttpContextBinding
- netTcpContextBinding
- webHttpBinding
- wsHttpContextBinding
Contract
A contract is an agreement between two parties. It defines how a client should communicate with your service.
The following are the possible types of contracts in WCF:
- Service Contract
- Data Contract
- Fault Contract
- Message Contract
In the Next article we will learn about the creating simple wcf services