Transmission of the foundation of WCF
The main transmission methods used in WCF are HTTP, TCP, and named pipe.
Binding includes three parts: Optional Protocol binding elements (such as security), required encoding binding elements, and required Transport Protocol binding elements, the transmission mode is determined by the transmission binding element.
HTTP is a request/response protocol between the client and the server. It is not based on a connection (that is, no communication session is required, we recommend that you use TCP to communicate with the named pipe.
TCP is the opposite of HTTP. It is based on connections and provides reliable transmission (TCP notifies the sender to start delivering packets to ensure that these packets are transmitted in the same order as when they are sent, transmission of lost packets and ensure that the data packets are not repeated). The TCP transmission of WCF is optimized based on the situation that both ends are based on WCF. Communication between different computers is achieved by using BinaryMessageEncodingBinddingElement encoding, TCP transmission also provides duplex communication.
The named pipe is an object in the Windows operating system kernel. It can be used for one-way or duplex communication between processes on a single computer. Communication is required between different WCF applications on the same computer, in addition, you can use a named pipeline to prevent any communication between the other computer.
If you select transmission, you need to select the message encoder to determine the situation in which the message exists in the transmission channel. The message encoder will not go into details as it was mentioned in the previous article. Here we will add three types of transmission quotas.
Timeout: This reduces the number of denial-of-service attacks that take up system resources for a long time.
Memory Allocation limit: prevents a single connection from consuming the system memory.
Set size limit: limits the consumption of indirect memory allocation or limited supply of resources.
Net. Tcp also has an important point: Port Sharing. Simply put, Port Sharing can reduce the number of ports exposed by the server, thus improving the security factor. To enable Port Sharing, you must first enable related windows functions, and then set protSharingEnabled = "true" in binding ".
<Binding name = "portSharedBiding" portSharingEnabled = "true">
Let's talk about it first. I have to take some time to read more books.