① Like the traditional distributed communication framework, WCF essentially provides a cross-process, cross-machine, and cross-network service call.
② The WCF Service cannot exist in isolation and must be hosted in a running process. We call the process that carries the WCF Service as the host, the process of specifying a host for a service is called service hosting ). Service hosting includes self-hosting and IIS hosting.
③ WCF uses contract-based interaction to implement service autonomy and loose coupling between the client and the server. WCF includes four types of contracts: service contract, data contract, message contract, and error contract.
④ In terms of functions, the Service Contract abstracts all operations provided by the Service. From the perspective of message exchange, the service contract defines the message exchange process based on service calls, structure of the request message and reply message, and the message exchange mode.
⑤ Define an interface as a service contract by applying the [servicecontract] feature on the interface, and the Members use [operationcontract].
⑥ The WCF Service depends on a running process (host). The service host specifies a host for the service. WCF is a message-based communication framework that uses an endpoint-based communication method. An endpoint consists of address, binding, and contract.
7. The purpose of service boarding is to start a process and provide a running environment for the WCF Service. Add one or more endpoints for the service to expose them to potential service consumers. The service consumer finally calls the service through a matched endpoint. We can useCodeTo complete all the services.
The description of the external WCF Service is published in the form of metadata (metadata. The publishing of metadata in WCF is implemented through servicemetadatabehavior, a special service behavior.
When developing a real WCF application, worker generally does not add endpoints and define service behavior directly by coding, but is configured.
Httpgeturl: The address SERVICE_NAME = namespace + class name contract = namespace + interface used to add service references