Working with .NET Remoting Under IIS Server and Using ASP.NET as Remote Client
page 2 of 7
by Abhishek Kumar Singh
Feedback
Average Rating: 
Views (Total / Last 10 Days): 8993/ 361

Building a remote server application using VB 2005

Create a library project to build the server interface.

Open Visual Studio 2005 IDE. Create a class project as: File >> New >> Projects.

Choose Visual Basic as in Project Types and "Class Library" in project templates.

Give the project name as IServer and click OK.

It will create the Iserver project containing a default class Class1.vb. Rename this class to IServer.vb.

Now implement the following code in Iserver.vb file.

Listing 1: Code for Iserver.vb

Public Interface IServer
  Function GetTimeFromServer() As DateTime
End Interface

Build the IServer project.

Create (Add) a library project to build the server object

In order to have remoting using IIS Server, we will build remote server object as an assembly. Then we will go for its setup into the IIS Server.

To add library project for remote server object: In IServer solution- File >> Add >> New Project.

Choose Visual Basic in the Project Types and "Class Library" in project templates. Give the project name as Server and click OK.

It will create the Iserver project containing a default class Class1.vb. Rename this class to MyServer.vb.

In this we need to import System.EnterpriseServices namespace and before doing it add a reference of System.EnterpriseServices into the project.

Project >> Add Reference >> Browse >> Locate the dll file \IServer\IServer\bin\Debug\IServer.dll (if build in debug mode) or \IServer\IServer\bin\Release\IServer.dll (if build in release mode) >> OK

For this example I assume the project is compiled in Debug mode.

We will implement the functions declared in IServer.dll by implementing the IServer interface. Change the class name in the code to clsServer. Add the following code in MyServer.vb for class clsServer to achieve this.

Listing 2: Code to implement functions of IServer interface

Public Class clsServer
    Inherits MarshalByRefObject
    Implements IServer.IServer
 
    'Implement server remote method
    Public Overridable Function GetTimeFromServer() As DateTime _
      Implements IServer.IServer.GetTimeFromServer
        Return Now.ToString()
    End Function
End Class

Build the Server project. If the build is successful then we are ready with the server object and to get it to setup in IIS Server.


View Entire Article

Article Feedback

Title:  
Name:  
Url: ( Optional )
Comment:  
Please add 2 and 6 and type the answer here:

User Comments

Title: Working with .NET Remoting Under IIS Server .........   
Name: Srinandan
Date: 7/31/2008 5:01:26 AM
Comment:
Thanks Abhishek.
I did it but used the console application which i have to execute everytime.

using class library with web.config using IIS made it easy to deploy..

Really i appreciate your job.
Title: finally a step by step guide   
Name: Fabrizio
Date: 6/28/2008 9:21:32 AM
Comment:
Thanks a lot for your article, some days wandering and i found only generic help. This article step by step guided me to a working solutions. Just two tips:
- explain better what you write in the web.config
- explain better the ways in which an ASP.NET page can call you (through global.asax activation and so on)

Thanks again,
Fabrizio
Title: article   
Name: sam
Date: 5/9/2008 3:33:12 AM
Comment:
good
Title: this article   
Name: abhishek singh
Date: 5/8/2008 3:22:04 AM
Comment:
this is actually for advance programmers only. In normal situation we don't require to host remoting under IIS. It's for hight level busineess processing.
Title: Working with .NET Remoting Under IIS Server and Using ASP.NET as Remote Client   
Name: Santy
Date: 5/8/2008 2:55:39 AM
Comment:
Its pretty gud but I dont think the beginners can understand the terminology much... so be as simple as you can... its just a suggestion rest is left up to you, but the article is really gud... I appreciate your effort.
Title: Very easy to read!   
Name: henkgijsbert
Date: 3/14/2008 5:07:15 PM
Comment:
Well done. Easy to read with lots of screen shots. No need for me to do it myself in order to get good understanding. Saves time.
Title: for C# version   
Name: Abhishek Singh (Author)
Date: 2/28/2008 7:11:37 AM
Comment:
you can easily get C# version of code. Just try to use some convertor available free on internet. You need to put part of vb code and then you will get C# version of that code..
then use that code in your C# project.
Title: mr   
Name: reddy
Date: 2/28/2008 5:25:06 AM
Comment:
could u pls write it in c-sharp?
Title: 404 error   
Name: Abhishek Singh
Date: 2/1/2008 10:51:05 AM
Comment:
Please check if you have set virtual directory to use proper .net framework.
Title: malinimarudhu@gmail.com   
Name: Malini
Date: 1/31/2008 7:25:27 AM
Comment:
Hi..

Its a good Stuff!!!
but i get "The remote server returned an error: (404) Not Found. "
Cause?
Title: Working with .NET Remoting Under IIS Server and Using ASP.NET as Remote Client   
Name: Mena
Date: 1/31/2008 7:23:08 AM
Comment:
Hi..
when i try this, i get the error
"The remote server returned an error: (404) Not Found. "
why?

Product Spotlight
Product Spotlight 
Learn More
.NET Tools
asp.net shopping cart
asp.net chart control






Ads Powered by Lake Quincy Media
Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2008 ASPAlliance.com  |  Page Processed at 8/30/2008 7:33:25 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search