Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the concept of WCF agreement

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "what is the concept of WCF Agreement". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what is the concept of WCF agreement"?

A service operation is a process defined in the code of a service that is used to implement the function of an operation. This operation is exposed to the client as a method on a WCF client. The method may return a value and may take an optional number of parameters, or it may take no parameters and return no response. For example, an operation that implements a simple "Hello" can be used as a client presence notification and can start a series of operations.

Service agreement

Service agreements link multiple related operations together to form a single functional unit. The WCF contract can define service-level settings, such as the namespace of the service, the corresponding callback contract, and other such settings. In most cases, contracts are defined by creating an interface in the programming language of your choice and applying the ServiceContractAttribute attribute to that interface. By implementing this interface, the actual service code can be generated.

Operation agreement

The operation WCF contract defines parameters and returns the type of operation. When you create an interface that defines a service contract, you can represent an operation contract by applying the OperationContractAttribute attribute to each method definition contained in the contract. You can model an operation to take a single message as a parameter and return a single message, or to take a set of types as parameters and return a type. In the latter case, the system determines the format of the messages that need to be exchanged for the operation.

Message agreement

The message contract describes the format of the message. For example, it declares whether the message element should be included in the header or in the message body, what level of security should be applied to what element of the message, and so on.

Wrong agreement

Error contracts can be associated with service operations to indicate errors that may be returned to the caller. An operation may have zero or more errors associated with it. These errors are SOAP errors modeled as exceptions in the programming model.

Data agreement

The data types used by the service must be described in the metadata so that other parties can interact with the service. The description of data types is called a data contract, and these types can be used in any part of the message (for example, as a parameter or return type). If the service uses only simple types, there is no need to explicitly use data contracts.

Host

The service must be hosted in a process. A host is an application that controls the lifetime of a service. Services can be self-hosted or managed by existing hosting processes.

Self-hosting service

A self-hosting service is a service that runs in a process application created by the developer. The developer controls the lifetime of the service, sets the properties of the service, opens the service (which sets the service to listening mode), and shuts down the service.

Host process

A hosting process is an application designed to host services. These hosting processes include Internet Information Services (IIS), Windows Activation Services (WAS), and Windows services. In these hosting scenarios, the lifetime of the service is controlled by the host. For example, using IIS, you can set up a virtual directory that contains service assemblies and configuration files. When a message is received, IIS starts the service and controls its lifetime.

Instantiation

The service has an instantiated model. There are three instantiated models: "single", in which a single CLR object serves all clients; "each call", in which a new CLR object is created to handle each client call; and "each session," in which a set of CLR objects is created and one object is used for each separate session. The choice of the instantiation model depends on the application requirements and the expected usage pattern of the service.

At this point, I believe you have a deeper understanding of "what is the concept of WCF agreement". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report