Tutorial: Get started with Windows Communication Foundation applications
The following series of tutorials introduce you to the Windows Communication Foundation (WCF) programming experience. Working through these tutorials in order will give you an introductory understanding of the steps required to create WCF applications. After you finish, you'll have a running WCF service and a WCF client that calls the service.
The tutorial assumes you're using Visual Studio as the development environment. If you're using another development environment, ignore the Visual Studio-specific instructions.
For more in-depth information about creating services and clients, see Basic WCF programming.
gRPC as an alternative to WCF
gRPC is a modern RPC framework that is a popular alternative to WCF. gRPC is built on top of HTTP/2, which provides a number of advantages over WCF, including:
- Performance: gRPC is much more efficient than WCF, especially for long-running connections.
- Scalability: gRPC is designed to scale to large numbers of clients and servers.
- Security: gRPC supports a variety of security mechanisms, including TLS and authentication.
- Cross-platform: gRPC is platform-neutral and can be used with a variety of programming languages.
For more information on developing or migrating WCF apps to gRPC, see:
- Why we recommend gRPC for WCF developers
- Comparing WCF to gRPC
- Introduction to gRPC for WCF developers
The first three tutorials describe how to define a WCF service contract, how to implement it, and how to host it. The service that you create is self-hosted within a console application. You can also host services under Microsoft Internet Information Services (IIS). For more information, see How to: Host a WCF Service in IIS. Although you use code to configure the service in the tutorial, you can also configure services within a configuration file.
You create a WCF contract with a user-defined interface. This contract defines the functionality that the service exposes.
After you define a contract, you must implement it with a service class.
Configure an endpoint for the service and host the service in a console application. For a service to become active, you must configure it and host it within a run-time environment. This run-time environment creates the service and controls its context and lifetime.
The next two tutorials describe how to create, configure, and use a client application to call the operations the service exposes. Services publish metadata that define the information a client application needs to communicate with the service. Visual Studio automates the process of accessing this metadata and uses it to construct the client application for the service. If you decide not to use Visual Studio, you can use the ServiceModel Metadata Utility tool (Svcutil.exe) instead.
Retrieve metadata for creating a WCF client proxy from a WCF service. You retrieve metadata by using Visual Studio to add a service reference or you can use the ServiceModel Metadata Utility tool. You specify the endpoint that the client uses to access the service.
Use the WCF client proxy to call the service operations.
- Conceptual overview
- Guide to the documentation
- What is Windows Communication Foundation
- WCF feature details
- Basic programming lifecycle
- Building clients
- Basic WCF programming
- How to: Create a duplex contract
- How to: Access services with a duplex contract
- ServiceModel Metadata Utility tool (Svcutil.exe)
- How to: Use Svcutil.exe to download metadata documents
- How to: Publish metadata for a service using a configuration file
- Using bindings to configure services and clients
- Getting started sample
- Windows Communication Foundation samples