What Is .NET Remoting?


.NET Remoting is a technology for communication between different application domains. Application domains are discussed in Chapter 16, “Assemblies.” Using .NET Remoting for communication between application domains can happen inside the same process, between processes on a single system, or between processes on different systems.

Different technologies can be used for communication with a client and a server application. You can program your application by using sockets, or you can use some helper classes from the System.Net namespace that make it easier to deal with protocols, IP addresses, and port numbers (see Chapter 35, “Accessing the Internet,” for details). Using this technology, you always have to send data across the network. The data you send can be your own custom protocol where the packet is interpreted by the server, so that the server knows what methods should be invoked. You not only have to deal with the data that is sent but also have to create threads yourself.

Using XML Web services, you can send messages across the network. With XML Web services you get platform independence. You also get a loose coupling between client and server, which means that it’s easier to deal with versioning issues. See Chapter 36, “Web Services with ASP.NET,” for information on ASP.NET Web Services.

With .NET Remoting you always have a tight coupling between client and server, because the same object types are shared. .NET Remoting brings CLR object functionality to methods that are invoked across different application domains.

The functionality of .NET Remoting can be described with the application types and protocols that are supported, and by looking at the term CLR Object Remoting.

Tip 

Although SOAP is offered by .NET Remoting, don’t assume that this can be used for interoperability between different platforms. The SOAP Document style is not available with .NET Remoting. .NET Remoting is designed for .NET applications on both sides. If you want to have interoperability, use Web services instead.

Be aware that .NET 3.0 offers another technology for communication. While ASP.NET Web Services is for platform-independent communication and .NET Remoting is designed for communication between .NET applications, Windows Communication Foundation (WCF) allows both platform-independent communication and fast binary communication between .NET applications. WCF allows for loose but also tight coupling. See Chapter 40, “Windows Communication Foundation,” for information on WCF.Application types and protocols.

.NET Remoting is an extremely flexible architecture that can be used in any application type over any transport, using any payload encoding.

Using SOAP and HTTP is just one way to call remote objects. The transport channel is pluggable and can be replaced. With .NET 2.0 you get HTTP, TCP, and IPC channels represented by the classes HttpChannel, TcpChannel, and IpcChannel, respectively. You can build transport channels to use UDP, IPX, SMTP, a shared memory mechanism, or message queuing - the choice is entirely yours.

Tip 

The term pluggable is often used with .NET Remoting. Pluggable means that a specific part is designed so that it can be replaced by a custom implementation.

The payload is used to transport the parameters of a method call. This payload encoding can also be replaced. Microsoft delivers SOAP and binary encoding mechanisms. You can use either the SOAP formatter with the HTTP channel or HTTP with the binary formatter. Of course, both of these formatters can also be used with the TCP channel.

Tip 

Although SOAP is used with .NET Remoting, you should be aware that only the SOAP RPC style is supported, whereas ASP.NET Web services supports both the DOC style (default) and the RPC style. The RPC style is obsolete in the new SOAP versions.

.NET Remoting not only enables you to use server functionality in every .NET application. You can use this technology anywhere - regardless of whether you are building a console or a Windows application, a Windows Service, or a COM+ component. .NET Remoting is also a good technology for peer-to-peer communication.

CLR Object Remoting

CLR Object Remoting is an importing aspect of .NET Remoting. All of the language constructs (such as constructors, delegates, interfaces, methods, properties, and fields) can be used with remote objects. .NET Remoting extends the CLR object functionality across the network. It deals with activation, distributed identities, lifetimes, and call contexts. This is a major difference from XML Web services. With XML Web services, the objects are abstracted and the client doesn’t need to know the object types of the server.




Professional C# 2005 with .NET 3.0
Professional C# 2005 with .NET 3.0
ISBN: 470124725
EAN: N/A
Year: 2007
Pages: 427

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net