Chapter 21 - Distributed Applications with .NET Remoting | |
bySimon Robinsonet al. | |
Wrox Press 2002 | |
In this chapter we will explore .NET Remoting. .NET Remoting can be used for accessing objects in another application domain, for example on another server. In Chapter 15, we discussed ASP.NET web services; these allow us to call objects on a remote server. .NET Remoting also offers programming web services, but it is more complex than ASP.NET, and also much more flexible. With .NET Remoting, we can offer web services from any application type, such as a Windows service or a Windows application. .NET Remoting offers great flexibility for the use of different network protocols and control of the formatting of any data that is sent across application domains.
In this chapter we will develop .NET Remoting objects, clients , and servers using the HTTP and TCP channel with the SOAP and binary formatter. First we will define the channel and formatter programmatically before we change the application to use configuration files instead, where only a few .NET Remoting methods are required. We will also write small programs to use .NET Remoting asynchronously, and calling event handlers in the client application.
The .NET Remoting classes can be found in the namespace System.Runtime.Remoting and sub-namespaces thereof. Many of these classes can be found in the core assembly mscorlib , and some that are needed only for cross-network communication are available in the assembly System.Runtime.Remoting .
The .NET Remoting topics we look at in this chapter, are as follows :
An overview of .NET Remoting
Contexts, which are used to group objects with similar execution requirements
Implementing a simple remote object, client, and server
The .NET Remoting architecture
Channels, messages, and sinks
SOAP and binary formatters
Activating well-known objects and client-activated objects
Passing objects across the network
Lifetime Management of stateful client-activated objects
.NET Remoting Configuration files
Hosting .NET Remoting objects in ASP.NET
Using Soapsuds to access the metadata of remote objects
Calling .NET Remoting methods asynchronously
Calling methods in the client with the help of events
Using the CallContext to automatically pass data to the server
.NET Remoting is a massive subject, but this chapter will provide you with the information and relevant examples you need to get started, and to gain a practical handle on the topic. For a deeper examination of .NET Remoting, see Professional C# Web Services: Building .NET Web Services with ASP.NET and .NET Remoting (Wrox Press, 1-861004-39-7).
Let's begin by finding out what .NET Remoting is.