A Simple Introduction to .NET Remoting

Client Application

Our applicaiton must register itself as a client for our remotable object and invoke the object as if it were part of the clients app domain. Because we will register the remotable object the .NET remoting system will intercept all calls and forward them to the remote object and then recieve the results.

Create another console application project called RemotingClient add a reference to our RemotableType class and add the following class:

using System;
using System.Runtime.Remoting;
public class Client
  public static void Main()
    RemotableType remoteObject = new RemotableType();
    Console.WriteLine( remoteObject.RemotableMethod() );

NOTE: We are using a reference to our remotable type class here and hence copying the assembly to the client because we need the type metadata. When the types methods are being invoked it will be the code on the remote server that is executed NOT the local code. A way round this is to use abstact classes or interfaces and deploy these on the client rather than the full implemented code. A simple example of this is included in the download .zip file.

Add an app.config file to the project and ensure the following entries are present:

              type="RemotableType, RemotableType"

This is registering our "RemotableType" class with .NET's remoting system. When a RemotableType is invoked the system will forward the calls onto the remote object.

You might also like...


About the author

Lee Gunn - .NET C# Scotland United Kingdom

Lee Gunn is a freelance Microsoft Certified Developer based in Glasgow, Scotland. Specialising in quality driven Internet solutions, largely built around Microsoft’s .NET platform.

Skills ...

Interested in writing for us? Find out more.


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The generation of random numbers is too important to be left to chance.” - Robert R. Coveyou