.NET remoting allows the development of distriubuted applications. It allows applications to use objects contained in other processes. These processes can reside on the same local computer or any remote computer that is reachable via a network (including the Internet).
We wil quickly look at the basics on how to set up a simple .NET remoting system. The system will comprise of:
- A remotable object (Abstract class and implementation)
- A Host console application which will sit and listen for object requests
- A Client console applicaiton that will make requests for the remotable object
Remotable Type
To enable our object to be remotable and hense accessible from other application domains, we have to inherit from System.MarshalByRefObject
. Create a new class library project called RemotableType
(the assembly should be called RemotableType.dll
). Now, add the class belown to the project.
using System;
public class RemotableType : MarshalByRefObject{
public string RemotableMethod()
{
return "Hello Word";
}
}
Comments