Terms related to WCF

Source: Internet
Author: User

WCF is a framework used to build service-oriented applications. WCF is a runtime and a group of APIs used to create a system for sending messages between a service and a client. Based on the concept of message-based communication, WCF can represent any content of a message in a unified manner in the programming model.

Message
A message is an independent data unit. It may consist of several parts, including the message body and message header.
Service
A service is a constructor that exposes one or more endpoints. Each of these endpoints exposes one or more service operations.
Endpoint
An endpoint is a structure used to send or receive messages (or execute both operations at the same time. An endpoint includes a location (Address) that defines the destination to which a message can be sent, a communication mechanism specification (binding) that describes how a message should be sent ), the definition of a group of messages that can be sent or received (or executed simultaneously) at this location (service agreement, used to describe which messages can be sent ).

Application endpoint

An endpoint is a service agreement published by an application and implemented by the application.
Infrastructure endpoint
An endpoint is exposed by the infrastructure to implement the functions required or provided by services unrelated to the service agreement. For example, a service may have an infrastructure endpoint that provides metadata.
Address
Specify the location where the message is received. It is specified as a uniform resource identifier (URI. The URI architecture specifies the transmission mechanism used to reach the address, such as HTTP and TCP. The level part of the URI contains a unique position. Its format depends on the transmission mechanism.

You can use the endpoint address to create a unique endpoint address for each endpoint in the service, or share an address between endpoints under certain conditions. The following example demonstrates an address that combines the HTTPS protocol with a non-default port:

Bind

The binding defines how the endpoint communicates with the outside world. It is constructed by a group of elements called binding elements, which are "stacked" together to form a communication infrastructure. At least the transmission protocol (such as HTTP or TCP) and the encoding used (such as text or binary) should be defined for binding ). The binding element can contain the specified details (for example, the message security mechanism used to protect the message or the message mode used by the endpoint.
Bind Element
The binding element represents a specific part of the binding, such as the implementation of transmission protocol, encoding, infrastructure-level protocols (such as WS-ReliableMessaging), and any other elements of the communication stack.
Action
Behavior is a factor that controls various runtime aspects of services, endpoints, specific operations, or clients. Actions are grouped by scope: common actions affect all endpoints globally. Service actions only affect service-related aspects. endpoints only affect attributes related to endpoints, action-level behaviors affect specific operations. For example, a service behavior is containment, which specifies how the service responds when too many messages may exceed the Service's processing capability. On the other hand, the endpoint behavior only controls the aspects related to the endpoint, such as the method and location for finding security creden.
Binding provided by the system
WCF contains bindings provided by many systems. These bindings are a set of binding elements optimized for specific solutions. For example, WSHttpBinding is specially designed to implement interoperability with various WS * standard services. By providing only the options that can be correctly applied to a specific scheme, these predefined bindings can save time. If the predefined binding does not meet your requirements, you can create your own custom binding.
Configuration and encoding
You can write, configure, or combine the two to control the application. The advantage of configuration is that it allows non-developers (such as network administrators) to directly Set client and service parameters after code writing, without re-compiling. You can use the configuration to set values (such as endpoints), and add endpoints, bindings, and actions to implement further control. By writing code, developers can strictly control all components of the service or client, check all settings completed through configuration, and rewrite the code as needed.
Service Operations
Service operations are defined in the Service Code and are used to implement certain operations. This operation is made public to the client as a method on the WCF client. This method can return a value with a number of optional parameters or no parameters and no response. For example, a simple "Hello" operation can be used as a notification to the client, and a series of operations can be started.
Service Agreement
The service agreement links multiple related operations to form a single function unit. Protocols can define service-level settings, such as service namespaces, corresponding callback protocols, and other such settings. In most cases, the Protocol definition method is to create an interface using the selected programming language, and then apply the ServiceContractAttribute attribute to the interface. By implementing this interface, you can generate actual service code.
Operation Agreement
The operation protocol defines parameters and returns the type of the operation. When creating an interface that defines a service agreement, you can apply the OperationContractAttribute attribute to each method definition contained in the agreement to represent an operation agreement. You can model an operation to use a single message as a parameter and return a single message, or use a group of types as parameters and return a type. In the latter case, the system determines the format of the message to be exchanged for this operation.
Message Protocol
The Message Protocol describes the Message format. For example, it declares whether the message element should be included in the message header or in the message body, and what level of security should be applied to the elements of the message.
Incorrect agreement
You can associate error agreements with service operations to indicate errors that may be returned to the caller. One operation can have zero or more errors associated with it. These errors are SOAP errors that are modeled as exceptions in the programming model.
Data protocols
The data type used by the Service must be described in the metadata so that other parties can interact with the service. The data type can be used in any part of the message (for example, as a parameter or return type ). If the service only uses a simple type, no explicit use of data protocols is required.
Host
The service must be hosted in a process. "Host"  Is an application that controls the lifetime of a service. Services can be self-hosted or managed by existing host processes.
Self-hosting service
The self-hosting service is a service that runs in a process application created by a developer. Developers control the service life, set service properties, open the Service (this sets the service to the listening mode), and disable the service.
Host Process
A host process is an application designed to host services. These host processes include Internet Information Service (IIS), Windows activation Service (WAS), and Windows service. In these host schemes, the host controls the service lifetime. For example, you can use IIS to set virtual directories that contain service assembly and configuration files. When a message is received, IIS starts the service and controls its survival.
Instantiation
Each service has an instantiation model. There are three instantiation models: "single". In this model, a single CLR object provides services for all clients; and "every call", in this model, A new CLR object is created to process each client call. In this model, a set of CLR objects are created and an object is used for each independent session. The choice of the instantiation model depends on the application requirements and the expected use mode of the service.
Client application
Client Applications exchange messages with one or more endpoints. The client application starts to work by creating a WCF client instance and calling the methods of the WCF client. Note that a single application can act as either a client or a service.
Channel
A channel is a concrete implementation of binding elements. Binding indicates configuration, and the channel is associated with the configuration. Therefore, each binding element has an associated channel. Channel stack together to form the specific implementation of binding: Channel stack.
WCF Client
The WCF client is a client application that exposes service operations as methods (written in the. NET Framework programming language you selected, such as Visual Basic or Visual C #). Any application can host the WCF client, including the application that hosts the service. Therefore, you can create a service for a WCF client that contains other services.

By using ServiceModel metadata utility (Svcutil.exe) and directing it to a running service that publishes metadata, You can automatically generate a WCF client.

Metadata
The metadata of a Service describes the features of a service. external entities need to understand these features to communicate with the service. ServiceModel metadata utility (Svcutil.exe) allows you to use metadata to generate a WCF client and client application that can be used to interact with the service.

The metadata published by the service includes the XML schema document (data protocol used to define the service) and the WSDL document (used to describe the service method ).

After metadata is enabled, WCF automatically generates service metadata by checking the service and its endpoints. To publish service metadata, you must enable the metadata behavior explicitly.

Security
Security in WCF includes confidentiality (message encryption to prevent eavesdropping), integrity (methods used to detect message tampering), authentication (methods used to verify servers and clients) and authorization (Resource Access Control ). These functions can be provided by leveraging existing security mechanisms (such as TLS over HTTP, also known as HTTPS) or by implementing one or more of the various WS-* security specifications.
Transmission Security Mode
Transport security mode specifies that the transport layer mechanism (such as HTTPS) provides confidentiality, integrity, and authentication. When using a transmission protocol like HTTPS, this mode has excellent performance and is easy to understand because it is very popular on the Internet. Its disadvantage is that such security is applied to every hop in the communication path, which makes the communication vulnerable to man-in-the-middle attacks.
Message Security Mode
The Message Security mode ensures Security by implementing one or more Security specifications, such as the specification "Web Services Security: SOAP Message Security" (Web Service Security: SOAP Message Security. Each message includes the necessary security mechanisms to ensure security during message transmission, and enable the receiver to detect tampering and decrypt the message. In this sense, security information is encapsulated in each message, providing end-to-end security across multiple hops. As security information is a part of a message, you can also include multiple creden in the message (these creden( are called "declarations" ). This method also has the advantage that messages can be securely transmitted through any transmission protocol (including multiple transmission protocols between the start point and the target. The disadvantage of this method is that the encryption mechanism used is complicated and the performance is affected.
Transmission security mode using message creden
This mode specifies that the transport layer is used to provide message confidentiality, authentication, and integrity. Each message can contain multiple creden。 (declarations) required by the message receiver ).
WS -*
A group of increasing Web Service (WS) specifications (such as WS-Security and WS-ReliableMessaging) implemented in WCF.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.