WCF 之 Getting Started Tutorial

Getting Started Tutorial

The topics contained in this section are intended to give you quick exposure to the Windows Communication Foundation (WCF) programming experience. They are designed to be completed in the order of the list at the bottom of this topic. Working through this tutorial gives you an introductory understanding of the steps required to create WCF service and client applications. A service is a construct that exposes one or more endpoints, each of which exposes one or more service operations. The endpoint of a service specifies an address where the service can be found, a binding that contains the information that a client must communicate with the service, and a contract that defines the functionality provided by the service to its clients.

After you work through the sequence of topics in this tutorial, you will have a running service, and a client that can invoke the operations of the service. The first three topics describe how to define a service with a contract, how to implement the service, and how to configure the service in code, host, and run the service. The service that is created is self-hosted and the client and service run on the same machine. The service is configured using code rather than configuration. Services can also be hosted under Internet Information Services (IIS). For more information about how to do this, see How To: How to: Host a WCF Service in IIS. Services can also be configured within a configuration file. For more information about using a configuration file see Configuring Services Using Configuration Files.

The next three topics describe how to create a client proxy, configure the client application, and create and use a client that can access the functionality of the service. Services publish metadata that can be accessed that define the constructs a client application needs to communicate with the service operations. WCF provides a ServiceModel Metadata Utility Tool (Svcutil.exe) to automate the process of accessing this published metadata and using it to construct and configure the client application for the service.

All of the topics in this section assume you are using Visual Studio 2008 as the development environment. If you are using another development environment, ignore the Visual Studio specific instructions.

For sample applications that can be downloaded to your hard disk and run, see the topics in Windows Communication Foundation Samples. For this topic, see, in particular, the Getting Started Sample.

For more in-depth information about creating services and clients, see Basic WCF Programming.

In This Section

How to: Define a Windows Communication Foundation Service Contract
Describes how to create a WCF contract using a user-defined interface. The contract defines the functionality offered by the service to the outside world and describes to potential users in that world how they communicate with the service.

How to: Implement a Windows Communication Foundation Service Contract
Describes how to implement a service contract. Once a contract is created, the functionality offered by the service has to be implemented in a class that inherits from the interface that defines the contract.

How to: Host and Run a Basic Windows Communication Foundation Service
Describes how to configure an endpoint for the service in code, how to host it inside of a console application, and start the service. To become active, a service must be configured and hosted within a run-time environment. This environment creates the service and controls its context and lifetime.

How to: Create a Windows Communication Foundation Client
Describes how to retrieve metadata used to create a WCF client from a WCF service. This process uses the ServiceModel Metadata Utility Tool (Svcutil.exe) provided by WCF.

How to: Configure a Basic Windows Communication Foundation Client
Describes how to configure a basic client that was created using the ServiceModel Metadata Utility Tool (Svcutil.exe). Configuring the client requires specifying the endpoint that the client uses to access the service.

How to: Use a Windows Communication Foundation Client
Describes how to use the WCF client proxy generated by the ServiceModel Metadata Utility Tool (Svcutil.exe) to invoke the functionality provided by the service.

Reference

Related Sections

See Also

posted on 2010-01-11 14:04  Acor  阅读(305)  评论(0编辑  收藏  举报

导航