Library tutorials & articles
A Simple Introduction to .NET Remoting
- Introduction
- Host Application
- Client Application
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()
{
RemotingConfiguration.Configure("RemotingClient.exe.config");
RemotableType remoteObject = new RemotableType();
Console.WriteLine( remoteObject.RemotableMethod() );
Console.ReadLine();
}
}
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:
<configuration>
<system.runtime.remoting>
<application>
<client>
<wellknown
type="RemotableType, RemotableType"
url="http://localhost:8989/RemotableType.rem"
/>
</client>
</application>
</system.runtime.remoting>
</configuration>
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.
Related articles
Related discussion
-
Problem after strong naming an assembly
by rinkurathor1 (0 replies)
-
Very slow inserts using SqlCommand.ExecuteNonQuery()
by porchelvi (1 replies)
-
VB.net class to connect to sql database
by senol01 (2 replies)
-
how to select item to datagrid from textbox
by chandradev1 (49 replies)
-
Adobe Flex reaches out to .NET developers
by ranganathanmca (1 replies)
Related podcasts
-
CodeCast Episode 4: State of .NET, IE8, ASP.NET MVC, and O'Reilly Media
CodeCast Episode 4: State of .NET, IE8, ASP.NET MVC, and O'Reilly MediaHosts Ken Levy and Markus Egger discuss the new State of .NET events, IE8, ASP.NET MVC, followed by an interview from PDC with two editors from O'Reilly Media. More on ASP.NET MVC can be found at http://asp.net/mvc. Interview...
Related jobs
-
Microsoft .Net Architect
in AMSTERDAM (€50K-€90K per annum) -
Applicatie ontwikkelaar binnen Defensie
in Amsterdam (£50K-£90K per annum) -
Business Analist (Openbaar) Vervoer
in Amsterdam (€50K-€90K per annum) -
Application Engineer (VB, .Net, Java) - Standplaats: Utrecht
in Amsterdam (€50K-€90K per annum)
Events coming up
-
Dec
6
Developing AJAX Web Applications with Castle Monorail
London, United Kingdom
Monorail is the model-view-controller engine of the Castle Project, bringing many of the best ideas of Ruby on Rails to the .NET world. In this talk, David De Florinier and Gojko Adzic show how Monorail makes it easy to develop .NET based AJAX applications, and how to use the Castle Project to build Web 2.0 applications effectively. Come to this session if you are a .NET web developer. Everyone is welcome!
hi,
i have an xml file
<?xml version="1.0" ?>
<users>
<User id="u1">
<UserName>user1</UserName>
<Password>pwd1</Password>
</User>
<User id="u2">
<UserName>user2</UserName>
<Password>pwd2</Password>
</User>
</users>
i want to read this file in c#.net and compare the username with username entered in textfield while logging.
can you help me?
hi,
i have an xml file
<?xml version="1.0" ?>
<users>
<User id="u1">
<UserName>user1</UserName>
<Password>pwd1</Password>
</User>
<User id="u2">
<UserName>user2</UserName>
<Password>pwd2</Password>
</User>
</users>
i want to read this file in c#.net and compare the username with username entered in textfield while logging.
can you help me?
hi,
i have an xml file
<?xml version="1.0" ?>
<users>
<User id="u1">
<UserName>user1</UserName>
<Password>pwd1</Password>
</User>
<User id="u2">
<UserName>user2</UserName>
<Password>pwd2</Password>
</User>
</users>
i want to read this file in c#.net and compare the username with username entered in textfield while logging.
can you help me?
This thread is for discussions of A Simple Introduction to .NET Remoting.