Architecture
Figure 1 shows the basic. NET Remoting architecture when a remote object is resident in ASP. NET. If you are concerned about security, we recommend that you use the ASP. NET host to communicate with the HTTP channel, because it allows remote objects to use the basic security services provided by ASP. NET and IIS.
For more information, see "select a host process" at the end of this chapter ".
Figure 1.. NET Remoting Architecture
The client communicates with the agent object in the process. You can use a remote object proxy to set authentication creden。, such as user names, passwords, and certificates ). You can use the receive chain to encrypt your own custom receive messages, and send and receive data over the network. On the server side, the call passes through the same pipeline and sends a call to the object.
Note the term "proxy" used in this chapter refers to the proxy object in the client process, through which the client communicates with the remote object. Do not confuse it with the term "Proxy Server.
Remoting receiving
When the client calls a method on a remote object,. NET Remoting uses the transmission channel, custom channel, and formatting channel to receive the method.
Transmission Channel receiving
The transmission channel receives method calls between the client and the server over the network .. NET provides the HttpChannel and TcpChannel classes, but it can fully expand the architecture and insert your own custom implementation methods.
◆ HttpChannel. This channel can be used when remote objects reside in ASP. NET. This channel uses the HTTP protocol to send messages between the client and the server.
◆ TcpChannel. When the remote object is resident in Microsoft? Windows? This channel can be used in operating system services or other executable files. This channel uses a TCP socket to send messages between the client and the server.
◆ Custom channel. Custom transmission channels can use any basic transmission protocol to send messages between the client and the server. For example, a custom channel can use a named pipe or mail slot.
Comparison transmission channel receiving
The following table compares the two main transmission channels.
Custom receiving
You can use a custom channel to modify the messages sent between the client and the server at different locations in the channel receiving pipeline. Channel receiving that provides encryption and decryption functions is an example of custom channel receiving.
Formatting Program Receiving
The formatter receives method calls and serializes them into a stream that can be sent over the network .. NET provides two formatting programs for receiving:
◆ Binary formatting program. It uses the BinaryFormatter class to package method calls into a serialized binary stream, and then transmits the stream using http post) to send data to the server. The binary formatter sets the content type in the HTTP request to "application/octet-stream ".
Compared with SOAP formatting, binary formatting provides higher performance.
◆ SOAP formatting program. It uses the SoapFormatter class to package method calls into SOAP messages. Set the content type to "text/xml" in the HTTP request and pass it to the server using http post.