Article ID: 2425649
This article describes an All-In-One Code Framework sample that is available for download. This code sample demonstrates how to use .NET Remoting for inter-process communications.
Collapse this imageExpand this image
Download informationTo download this code sample, click the following link:
Technical overview.NET remoting provides an abstract approach to interprocess communication that separates the remotable object from a specific client or server application domain and from a specific mechanism of communication.
.NET remoting allows an application to make a remotable object available across remoting boundaries, which includes different appdomains, processes or even different computers connected by a network. .NET Remoting makes a reference of a remotable object available to a client application, which then instantiates and uses a remotable object as if it were a local object. However, the actual code execution happens at the server-side. Any requests to the remotable object are proxied by the .NET Remoting runtime over Channel objects that encapsulate the actual transport mode, including TCP streams, HTTP streams and named pipes. As a result, by instantiating proper Channel objects, a .NET Remoting application can be made to support different communication protocols without recompiling the application. The runtime itself manages the act of serialization and marshalling of objects across the client and server appdomains.
In the code sample, CSRemotingServer (or VBRemotingServer) is a .NET Remoting server project. It contains the following remotable objects:
RemotingShared.SingleCallObjectSingleCallObject is a server-activated object (SAO) with the "SingleCall" instancing mode. Such objects are created on each method call and objects are not shared among clients. State should not be maintained in such objects because they are destroyed after each method call.
RemotingShared.SingletonObjectSingletonObject is a server-activated object (SAO) with the "Singleton" instancing mode. Only one object will be created on the server to fulfill the requests of all the clients; that means the object is shared, and the state will be shared by all the clients.
RemotingShared.ClientActivatedObject defined in the shared assembly CSRemotingSharedLibrary.DLL or VBRemotingSharedLibrary.DLLClientActivatedObject is a client-activated object (CAO) for .NET Remoting. Client-activated objects are created by the server and their lifetime is managed by the client. In contrast to server-activated objects, client-activated objects are created as soon as the client calls "new" or any other object creation methods. Client-activated objects are specific to the client, and objects are not shared among different clients; object instance exists until the lease expires or the client destroys the object.
CSRemotingClient (or VBRemotingClient) is the .NET Remoting client project. It accesses the remotable objects (SingleCall objects or Singleton objects or client-activated objects) exposed by the .NET Remoting server project CSRemotingServer (or VBRemotingServer).
You can configure .NET Remoting using an application configuration file or in code. Both methods are demonstrated in the code samples.
LanguagesThis code sample contains the following programming languages:
Collapse this tableExpand this table
What is All-In-One Code Framework?All-In-One Code Framework shows most Microsoft development techniques by using code samples in different programming languages. Each example is carefully selected, composed, and documented to show one common code scenario. For more information about All-In-One Code Framework, visit the following Web site:
How to find more All-In-One Code Framework samplesTo find more All-In-One Code Framework samples, you can simply click the following link:
For more information about .NET Framework Remoting Architectur, visit the following websites:
.NET Framework Remoting ArchitectureFor more information about .NET Framework Remoting Architecture, visit the following websites:
.NET Framework Remoting Overview
Rapid publishing disclaimerMicrosoft corporation and/or its respective suppliers make no representations about the suitability, reliability, or accuracy of the information and related graphics contained herein. All such information and related graphics are provided "as is" without warranty of any kind. Microsoft and/or its respective suppliers hereby disclaim all warranties and conditions with regard to this information and related graphics, including all implied warranties and conditions of merchantability, fitness for a particular purpose, workmanlike effort, title and non-infringement. You specifically agree that in no event shall Microsoft and/or its suppliers be liable for any direct, indirect, punitive, incidental, special, consequential damages or any damages whatsoever including, without limitation, damages for loss of use, data or profits, arising out of or in any way connected with the use of or inability to use the information and related graphics contained herein, whether based on contract, tort, negligence, strict liability or otherwise, even if Microsoft or any of its suppliers has been advised of the possibility of damages.
Article ID: 2425649 - Last Review: November 17, 2010 - Revision: 3.0