Developer Story Windows Communication Foundation


Windows Communication Foundation (WCF) is a framework for building and running service-oriented applications. WCF unifies and extends the functionality of existing Microsoft connecting technologies, providing a single programming model independent of underlying communications protocols. WCF applications can interoperate with other technologies using open standards and protocols. WCF is a core component of the .NET Framework 3.0 runtime, which will be standard for Windows Vista® and made available for both Windows XP and Windows Server 2003.

For more information about Windows Communication Foundation, please visit the Windows Communication Foundation ( site, and the Web Services and Other Distributed Technologies Developer Center ( site.

Characteristics and Benefits

Windows Communication Foundation delivers the following primary benefits: service-oriented architecture (SOA) support, flexible support for messaging models, a unified programming model, protocol neutrality, increased reliability, standards-based interoperability, integrated security and messaging services, and a flexible architecture designed for extensibility.

Service-Oriented Architecture (SOA)

Windows Communication Foundation is based on the principles of service-oriented architecture and programming. Service-orientation is an important complement to object-orientation that applies the lessons learned from component software, message-oriented middleware, and distributed object computing. Whereas object-oriented development focuses on applications that are built from interdependent classes, service-oriented development focuses on systems that are built from a set of autonomous services. The internal implementation of each service could be object-oriented.

Client and server applications built with WCF are composed of .NET Framework 3.0-supplied and developer-created classes. For very complex applications, an intermediate level of organization, called component architecture may also be applied, as depicted for a service in the following diagram:


A set of deployed, interacting services is called a system. SOA interactions are loosely-coupled because all communication is based upon published contracts and policies, standardized protocols, and schematized information. Contracts describe published interfaces, their operations, and the corresponding messages.

Unified Programming Model

Windows Communication Foundation represents the next generation connecting technology that combines and extends the best attributes of existing connecting technologies to deliver a unified development and runtime experience. It provides a single API and a consistent, straightforward programming model that supersedes the following technologies:

  • DCOM and .NET Remoting support for efficient Remote Procedure Call (RPC) functionality.

  • ASP.NET Web Services (ASMX) support for easily configurable, interoperable Web Services.

  • .NET Framework Enterprise Services support for synchronization, distributed transactions, basic security, and distributed COM+ services.

  • Web Services Enhancements (WSE) support for open Web Service standards, collectively known as WS-* specifications. This includes security, reliable messaging, and distributed transactions specifications.

  • Queued messaging that is compatible with either MSMQ or the .NET Framework System.Messaging namespace technologies.

Flexible Support for Messaging Models

Classical Web services typically assume a request/reply message exchange pattern, where the client issues a request message and the service responds with a reply message. This pattern is particularly suited to HTTP because it is a stateless protocol with no delivery guarantees. In contrast, Windows Communication Foundation enables a wide variety of message topology solutions.

Two main communication state models are supported:

  • A stateless model — messages are received with few or no guarantees. The stateless model is equivalent to most current-day Web services and is useful when broadcasting non-critical, one-way information.

  • A stateful model — creates a communication session between two service objects. This model uses session state to enable Web services to provide advanced message functionality across the Internet, including callback methods, events, widely distributed transactions, and reliability and durability guarantees that enterprise applications require.

Three basic message-exchange patterns are supported:

  • Datagram — one-way invocation, no response.

  • Request/reply — one way invocation with response.

  • Duplex — two-way invocation.


    Request/reply and duplex messages can be invoked synchronously or asynchronously. Each node can act as a client, service, or both.

Windows Communication Foundation provides a variety of built-in transports and messaging protocols and supports custom transports and protocols. More complex messaging solutions (for example, publish-and-subscribe or peer-to-peer) can be built on top of these basic capabilities.

Protocol Neutrality and Flexibility

Windows Communication Foundation contains a set of predefined communication bindings (a binding is a set of communication characteristics including communication protocols) that will serve a wide range of common usage scenarios. However, the protocol-agnostic design of WCF supports flexibility in the following ways:

  • The messages exchanged between service and clients are defined in contracts that are independent of the protocols used to exchange those messages.

  • A single service can support multiple protocols simultaneously.

  • A pluggable communication infrastructure enables custom protocols to be defined and used in a straightforward manner.

Protocols can be selected through both imperative code and configuration files. Typically, the developer implements the logic of an application, including default protocols and minimum requirements, and the service administrator specifies configuration details at deployment, which often include the actual protocols used. These deployment-time policies do not require recoding or recompilation, enabling the administrator to tune the deployment of the service or client.


The reliability and robustness of solutions built with the Windows Communication Foundation is assured for a number of reasons, including:

  • SOA requires loosely-coupled, autonomous clients and services, which increases unit isolation; the loss or corruption of one service does not bring down the entire solution.

  • Message delivery can be assured at either the transport level or at the message level using the WS-Reliable Messaging protocol. This guarantees that messages are delivered in a consistent pattern (for example, in-order and delivered exactly once).

  • For more sophisticated requirements, queued messaging through MSMQ is supported.

  • Powerful mechanisms are available to handle critical failures; internal application exceptions and external message faults are handled in an elegant and consistent fashion.

  • Distributed transaction support increases the reliability of a solution by enforcing operation consistency and further decreasing process coupling.

  • Perhaps most importantly, WCF eliminates the need for each organization or project to develop their own messaging infrastructure, freeing them to concentrate on developing code in their area of expertise.


Windows Communication Foundation supports extensibility through the following features:

  • A thoroughly extensible object model, making it possible to customize the product to suit specific customer needs.

  • Composable protocol channels that allow combining or stacking existing protocols to satisfy scenario requirements.

  • An architecture designed to support pluggable extension classes so that the following areas can be customized: protocols, transports, behaviors, bindings, serializers, message inspectors, and validators. These types of extensions are beyond the scope of this document, but for more information, see "Extending Windows Communication Foundation" in the Windows SDK.

From a developer's perspective, these extensibility features are both straightforward and powerful to use.

Integration and Interoperability

The Windows Communication Foundation assures a high level of compatibility with other Web services and existing Microsoft messaging technologies. Interoperability is often a primary concern for large scale, organization-wide solutions (for example, Enterprise Application Integration (EAI) and Business-to-Business Integration). Messaging interoperability issues fall into two categories:

  • With other messaging platforms, possibly residing on heterogeneous operating systems and programming languages

  • With other Microsoft services and messaging technologies

From a messaging perspective, WCF is designed to be platform-agnostic. Because it uses open WS-* standards to transport, format, and interpret messages, it can interoperate with any other messaging system that relies on these same standards. Specifically, WCF services will interoperate with any system that communicates using WS-I Basic Profile (BP)-compliant wire protocols. (The Web Services Interoperability Organization (WS-I) is a consortium of leading Web service leaders whose mission is to develop and promote interoperable messaging standards.) For example, WCF interoperates with existing ASP.NET Web services (ASMX). WS-* standards for reliability, security, and transactions are also supported, which makes it interoperable with the Web Services Enhancements for .NET Framework (WSE) 3.0.

The following diagram depicts the Web services stack and lists the primary standards supported at each level.


Microsoft has also done significant work to assure compatibility of Windows Communication Foundation with existing Microsoft technologies for building distributed systems (for example, Enterprise Services, COM+ services, and Message Queuing). Applications built with these existing technologies can now easily expose functionality as Web services. Windows Communication Foundation can communicate with these applications using standard Web service's profiles. The migration of existing applications that use .NET Remoting, ASP.NET Web services, and .NET Framework Enterprise Services to natively use the Windows Communication Foundation is often straightforward and cost-efficient. More information on specific integration approaches will be published on MSDN online.

From a general application development standpoint, Windows Communication Foundation integrates seamlessly with other managed technologies, and through .NET interop, with unmanaged technologies.

Integrated Security and Messaging Services

Security is a prime consideration. Message identity, confidentiality, integrity, authentication, authorization, and auditing are provided through transport- or message-level security mechanisms.

Security Level





Point-to-point security that protects the entire message by encrypting the communication stream. Transport-level security schemes are widely deployed and usually more efficient than message-level security.


WS-Security family of specifications

End-to-end security where only message contents, or portions of them, are encrypted. Message-level security schemes are independent of transports and message-exchange patterns. Although they tend to be slower to process, they are much more flexible and extensible, and can use a variety of authentication schemes.

Windows Communication Foundation also provides a basic level of federation, in that a service can be configured to accept security credentials from multiple authorities, possibly using different identity and authorization schemes. Other areas of security (for example, authentication, non-repudiation, auditing, and resource protection) are provided by the .NET Framework or the Windows operating system.

In addition to basic delivery and security, a wide range of high-level message services are provided, including:

  • Metadata — WS-Policy, WS- Policy Attachments, and WS- Metadata Exchange protocols (in addition to WSDL used to describe Web services) are supported to dynamically convey service metadata.

  • Queued messaging — WCF delivers queued messaging functionality by using MSMQ as an underlying transport. Integration with an existing Message Queuing solution and the creation of a new asynchronous queue are both supported.

  • Transactions — WS-Atomic Transaction and WS-Coordination protocols are supported through the managed System.Transactions namespace. This service allows two or more nodes, possibly interoperating using WS-*protocols, to participate in a distributed transaction.

  • Content-based Routing — routing is enabled through support of the WS-Addressing protocol and custom WCF routers. Routing can be refined by filtering on content using the WCF filtering feature.

Other services (for example, service management, process orchestration, and message eventing) are not supported directly by Windows Communication Foundation. Support for these is either provided by the Windows operating system, other products (Microsoft BizTalk Server), or can be added using the extensibility mechanisms described previously.