Monday 15 July 2013

What is WCF (Windows Communication Foundation)? How many types of bindings are there in WCF? And WCF Features?


In this article I will explain what is WCF (Windows Communication Foundation)? How many types of bindings are there in WCF? And WCF Features?

WCF is a framework for building service-oriented application. You can send data as asynchronous messages from one service endpoint to another. This is great network distributed system developed by Microsoft for communication between applications.

WCF Architecture:




Types of Bindings
Basic binding
Offered by the
 BasicHttpBinding class, basic binding is designed to expose a WCF service as a legacy ASMX web service so that old clients can work with new services. The basic binding makes your service look, on the wire, like a legacy web service that communicates over the basic web service profile. When used by clients, this binding enables new WCF clients to work with old ASMX services.

TCP binding
Offered by the
 NetTcpBinding class, TCP binding uses TCP for cross-machine communication on the intranet. It supports a variety of features, including reliability, transactions, and security, and is optimized for WCF-to-WCF communication. As a result, it requires both the client and the service to use WCF.

IPC binding
Offered by the
 NetNamedPipeBinding class, IPC binding uses named pipes as a transport for same-machine communication. It is the most secure binding, since it cannot accept calls from outside the machine. The IPC binding supports a variety of features similar to the TCP binding. It is also the most performant binding, since IPC is a lighter protocol than TCP.

Web Service (WS) binding
Offered by the
 WSHttpBinding class, the WS binding uses HTTP or HTTPS for transport and offers a variety of features (such as reliability, transactions, and security) over the Internet, all using the WS-* standards. This binding is designed to interoperate with any party that supports the WS-* standards.

MSMQ binding
Offered by the
 NetMsmqBinding class, the MSMQ binding uses MSMQ for transport and offers support for disconnected queued calls. 
Peer Network Binding
Offered by the NetPeerTcpBinding class, this uses peer networking as a transport. The peer network-enabled client and services all subscribe to the same grid and broadcast messages to it.

Federated WS Binding

Offered by the WSFederationHttpBinding class, this is a specialization of the WS binding, offering support for federated security.

Duplex WS Binding

Offered by the WSDualHttpBinding class, this is similar to the WS binding except it also supports bidirectional communication from the service to the client.

MSMQ Integration Binding

Offered by the MsmqIntegrationBinding class, this converts WCF messages to and from MSMQ messages, and is designed to interoperate with legacy MSMQ clients.

Features of WCF

WCF includes the following set of features. For more information, see WCF Feature Details.

  • Security 

    Messages can be encrypted to protect privacy and you can require users to authenticate themselves before being allowed to receive messages. Security can be implemented using well-known standards such as SSL or WS-Secure Conversation. For more information, see
     Windows Communication Foundation Security.
  • Multiple Transports and Encoding 

    Messages can be sent on any of several built-in transport protocols and encoding  The most common protocol and encoding is to send text encoded SOAP messages using is the Hypertext Transfer Protocol (HTTP) for use on the World Wide Web. Alternatively, WCF allows you to send messages over TCP, named pipes, or MSMQ. These messages can be encoded as text or using an optimized binary format. Binary data can be sent efficiently using the MTOM standard. If none of the provided transports or encoding suit your needs you can create your own custom transport or encoding. For more information about transports and encoding supported by WCF see Transports in Windows Communication Foundation.
  • Reliable and Queued Messages 

    WCF supports reliable message exchange using reliable sessions implemented over WS-Reliable Messaging and using MSMQ. For more information about reliable and queued messaging support in WCF see
     Queues and Reliable Sessions. 
  • Durable Messages 

    A durable message is one that is never lost due to a disruption in the communication. The messages in a durable message pattern are always saved to a database. If a disruption occurs, the database allows you to resume the message exchange when the connection is restored. You can also create a durable message using the Windows Workflow Foundation (WF). For more information, see
     Workflow Services.
  • Transactions 

    WCF also supports transactions using one of three transaction models: WS-AtomicTtransactions, the APIs in the
     System. Transactions namespace, and Microsoft Distributed Transaction Coordinator. For more information about transaction support in WCF see Transactions.
  • AJAX and REST Support 

    REST is an example of an evolving Web 2.0 technology. WCF can be configured to process "plain" XML data that is not wrapped in a SOAP envelope. WCF can also be extended to support specific XML formats, such as ATOM (a popular RSS standard), and even non-XML formats, such as JavaScript Object Notation (JSON).
     
  • Extensibility 

    The WCF architecture has a number of extensible points. If extra capability is required, there are a number of entry points that allow you to customize the behavior of a service. For more information about available extensible points see Extending WCF.

  • Service Orientation 

    One consequence of using WS standards is that WCF enables you to create
     service oriented applications. Service-oriented architecture (SOA) is the reliance on Web services to send and receive data. The services have the general advantage of being loosely-coupled instead of hard-coded from one application to another. A loosely-coupled relationship implies that any client created on any platform can connect to any service as long as the essential contracts are met. 
  • Interoperability 

    WCF implements modern industry standards for Web service interoperability. For more information about the supported standards, see
    Interoperability and Integration.
  • Multiple Message Patterns 

    Messages are exchanged in one of several patterns. The most common pattern is the request/reply pattern, where one endpoint requests data from a second endpoint. The second endpoint replies. There are other patterns such as a one-way message in which a single endpoint sends a message without any expectation of a reply. A more complex pattern is the duplex exchange pattern where two endpoints establish a connection and send data back and forth, similar to an instant messaging program. For more information about how to implement different message exchange patterns using WCF see
     Contracts.
  • Service Metadata 

    WCF supports publishing service metadata using formats specified in industry standards such as WSDL, XML Schema and WS-Policy. This metadata can be used to automatically generate and configure clients for accessing WCF services. Metadata can be published over HTTP and HTTPS or using the Web Service Metadata Exchange standard. For more information,
    see Metadata.
  • Data Contracts 

    Because WCF is built using the .NET Framework; it also includes code-friendly methods of supplying the contracts you want to enforce. One of the universal types of contracts is the data contract. In essence, as you code your service using Visual C# or Visual Basic, the easiest way to handle data is by creating classes that represent a data entity with properties that belong to the data entity. WCF includes a comprehensive system for working with data in this easy manner. Once you have created the classes that represent data, your service automatically generates the metadata that allows clients to comply with the data types you have designed. For more information,
    see Using Data Contracts

No comments:

Post a Comment