Which is popular WCF or Web API

What is the Windows Communication Foundation?

  • 3 minutes to read

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 an always-on service hosted by IIS, or it can be a service hosted in an application. An endpoint can be a client of a service that requests data from a service endpoint. The messages can simply consist of a single character or word sent as XML or a complex stream of binary data. Some example scenarios include the following:

  • A secure business transaction processing service.

  • A service that provides current data for other services, e.g. For network traffic reporting services or other monitoring services.

  • A chat service that allows two people to communicate or exchange data in real time.

  • A dashboard application that queries and logically presents data from one or more services.

  • Makes a workflow implemented with Windows Workflow Foundation available as a WCF service.

  • A Silverlight application used to query current data feeds from a service.

Although it was possible to build such applications before WCF existed, WCF makes endpoint development easier than ever. In summary, WCF is designed to provide a manageable approach to building web services and web service clients.

Functions of WCF

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

  • Service alignment

    A consequence of using WS standards is that WCF allows you to Service oriented Create applications. Service Oriented Architecture (SOA) is used by web services to send and receive data. The general benefit of the services is that they are loosely linked and not hard-coded. A loosely linked relationship implies that any client created on any platform can be connected to any service as long as the essential agreements are met.

  • Interoperability

    WCF implements modern industry standards for the interoperability of web services. 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-response pattern, in which one endpoint requests data from a second endpoint. The second endpoint responds. There are other patterns such as B. a one-way message where a single endpoint sends a message without expecting a response. A more complex pattern is the duplex messaging pattern, in which two endpoints connect and send data to each other like an instant messaging program. For more information about how to implement various messaging 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 access to WCF services. Metadata can be published using HTTP and HTTPS, or the web services metadata exchange standard. For more information, see Metadata.

  • Data contracts

    Because WCF is built using the .NET Framework, it also includes code-friendly methods for deploying the contracts you want to enforce. One of the universal contract types is the data contract. The easiest way to manage data when coding the service using Visual C # or Visual Basic is to create classes that represent a data entity with properties associated with the data entity. WCF contains a comprehensive system for working with data easily. After you've created the classes that represent data, the service automatically creates the metadata that clients can use to process the types of data you design. For more information, see Using Data Contracts.

  • Security

    Messages can be encrypted for privacy and users can be asked to authenticate before they are allowed to receive messages. Security can be implemented using well-known standards such as SSL or WS-SecureConversation. See Security for more information.

  • Multiple transports and coding

    Messages can be sent using the many built-in transport protocols and encodings. The most common protocol and encoding is sending text-encoded SOAP messages using Hypertext Transfer Protocol (http) for use on the World Wide Web. Alternatively, you can use WCF 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 transport or encoding options meet your needs, you can create a custom transport or encoding option. For more information about transports and encodings supported by WCF, see Transports.

  • Reliable news broadcast and queued messages

    WCF supports reliable messaging with reliable sessions implemented through WS-Reliable Messaging and using MSMQ. For more information about how reliable and queued messaging support in WCF, see Queues and Reliable Sessions.

  • Permanent news

    A persistent message is one that is never lost due to a break in communication. The messages in a persistent message pattern are always stored in a database. If the connection is interrupted, the exchange of messages with the database can be continued after the connection has been re-established. You can also use the Windows Workflow Foundation (WF) to create a permanent message. For more information, see Workflow Services.

  • Transactions

    WCF also supports transactions that use one of the three transaction models: WS-AtomicTransactions, the APIs in the System.Transactions namespace, and Microsoft Distributed Transaction Coordinator. For more information on transaction support in WCF, see Transactions.

  • Support for AJAX and REST

    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: b. Atom (a popular RSS standard) and even non-XML formats such as. b. JavaScript Object Notation (JSON).

  • Expandability

    The WCF architecture has a number of expansion points. If additional skills are needed, there are several points you can use to customize the behavior of a service. For more information on available extensibility points, see Extending WCF.

WCF integration with other Microsoft technologies

WCF is a flexible platform. Because of this extremely flexible flexibility, WCF is also used in several other Microsoft products. Once you learn the basics of WCF, you will have an immediate benefit from using any of these products as well.

The first technology to be coupled with WCF was the Windows Workflow Foundation (WF). Workflows simplify application development by encapsulating steps in the workflow as "activities". In the first version of Windows Workflow Foundation, a developer had to create a host for the workflow. The next version of Windows Workflow Foundation has been integrated into WCF. This made it possible for any workflow to be easily hosted in a WCF service. To do this, automatically select the WF / WCF project type in Visual Studio 2012 or higher.

Microsoft BizTalk Server R2 also uses WCF as a communication technology. BizTalk is designed to receive and convert data from one standard format to another. Messages must be sent to the application's central inbox, where they can be converted either by strict assignment or with one of the BizTalk functions (e.g. workflow engine). BizTalk can now use the WCF Line of Business (LOB) adapter to send messages to the message box.

Microsoft Silverlight is a platform for the development of interoperable and high-performance web applications with which developers can create multimedia websites (e.g. with video streams). As of version 2, WCF is integrated into Silverlight as a communication technology to connect Silverlight applications to WCF endpoints.

The hosting features of the Windows Server AppFabric application server are specifically designed for deploying and managing applications that use WCF for communication. The hosting features include extensive tools and configuration options specially designed for WCF-enabled applications.

additional Information