Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the basics of WCF

Shulou Source: shulou.com Published: 2022-06-02 06:40:39 11月12日 Update

This article mainly introduces "what are the basic knowledge of WCF". In daily operation, I believe many people have doubts about the basic knowledge of WCF. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubts about "what is the basic knowledge of WCF?" Next, please follow the editor to study!

The basic functions of WCF are placed in a separate assembly, System.ServiceModel.dll. Some of the most important technical elements of WCF are: binding, contract, and endpoint.

As mentioned earlier, binding encapsulates the composition order and processing details of the channel, which directly determines the communication mode of the WCF, the encoding of the message, the protocol of the channel, the reliability and security of message delivery, and so on. By using bindings, we do not need to know the details of the implementation of messages in the WCF channel, thus simplifying programmer development. Because of this, WCF provides developers with multiple built-in bindings that basically cover most of the scenarios of WCF applications. The following are the built-in bindings listed by Aaron Skonnard in the article "WCF Deep binding":

Binding class name

Transmission

Message coding

Message version

Safety mode

Reliable messaging

Transaction flow (disabled by default)

BasicHttpBinding

HTTP

Text

SOAP 1.1

None

Not supported

Not supported

WSHttpBinding

HTTP

Text

SOAP 1.2 WS-Addressing 1.0

Message

Forbidden

WS-AtomicTransactions

WSDualHttpBinding

HTTP

Text

SOAP 1.2 WS-Addressing 1.0

Message

Enable

WS-AtomicTransactions

WSFederationHttpBinding

HTTP

Text

SOAP 1.2 WS-Addressing 1.0

Message

Forbidden

WS-AtomicTransactions

NetTcpBinding

TCP

Binary system

SOAP 1.2

Transmission

Forbidden

OleTransactions

NetPeerTcpBinding

P2P

Binary system

SOAP 1.2

Transmission

Not supported

Not supported

NetNamedPipesBinding

Named pipe

Binary system

SOAP 1.2

Transmission

Not supported

OleTransactions

NetMsmqBinding

MSMQ

Binary system

SOAP 1.2

Message

Not supported

Not supported

MsmqIntegrationBinding

MSMQ

Not supported (using the previous serialization format of WCF)

Not supported

Transmission

Not supported

Not supported

CustomBinding

You decide

You decide

You decide

You decide

You decide

You decide

Each binding corresponds to a different transport protocol, message encoding format and version, as well as security, reliability, and transaction modes. The basic WCF functionality also provides ways to extend bindings, such as through CustomBinding or by defining classes that derive from Binding.

WCF's contracts include service contracts, data contracts, and message contracts (specifically, error contracts for exception handling). The service contract is the core of the service-oriented application, through which the service can be defined. The data contract is the data to be transmitted by the service. Because the invocation of a service requires communication across processes or machines, service data must be able to be serialized and deserialized. Although .NET itself provides the serialization of data, WCF's data contract is more in line with the habit of defining service data. As for message contracts, service data can be defined as messages, including XML text format, MTOM (message Transport Optimization Mechanism) format, and binary format.

At this point, the study of "what are the basics of WCF" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Message support contract service data transmission foundation knowledge binary text format basic knowledge sequence learning security function way program code channel Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi vpn MySQL OPPO Reno Docker