In the previous article we used Soapsuds to extract the metadata from the Remoting Server so that we don't need to deploy the complete implementation assembly to your clients.
Another alternative way is to use Interfaces to access remote objects instead of using SoapSuds.There are many articles available on the internet which discusses the pro's and Con's of Interfaces Vs Soapsuds.
Create the Interface dll
Create a Class library called Inter.
public interface IService
int Addition (int num1,int num2)
Creating the Server Application
Create a Class library called ServerApp which Implements the IService Interface
public class Service: MarshalByRefObject,IService
public int Addition (int num1,int num2)
return num1 + num2;
Steps to deploy this Server in IIS.
1. Create a new folder and we will call it as "RemotingSample".
2. Create another new folder called "bin" inside RemotingSample folder.
3. Place the ServerApp.dll inside the "bin" folder.
4. Place the following Web.Config file inside the RemotingSample folder.
<wellknown mode="SingleCall" objectUri="AdditionService.rem" type="ServerApp.Service, ServerApp"/>
5. Create a virtual directory in IIS.. say MyServer and map the path to the RemotingSample folder. You can test whether the Server is properly deployed by typing in
The Distributed Inter.dll will be available to the Client.
1. Create a Windows Forms Application.
2. Add Reference to the Inter.dll in this application
3. Add a button and in the Button Click Event add the following Code :-
IService obj = (IService) Activator.GetObject(typeof(IService),"http://ServerName/MyServer/AdditionService.rem");
4. In the form load add the follwing Code..
HttpChannel channel = new HttpChannel();
This method will help you to use interface based remoting .
U Can Reach me @ 9840063939
It is really a nice article. it is really helpful for learner.
Thankx to this.
I have changed server name as localhost. I am getting The page cannot be displayed error. Please let me know what i have missed.
Keep up the good work.I expect a similar article on webservices from you.
It is really a good article for the beginners.
this is shashi kant pathak from delhi working as a senior programmer.
presently i am developing a software which require the remoting.
but i am completing it. i have study you article
in the web.config file there is a line
in which is am not under standing that what is additionServices.rem is it a external file or what?
In Steps to deploy this Server in IIS-- Step 3
don't we need to add Interface dll i.e inter in the bin folder ???