Need help in Microsoft's Remote Object application

Posted on 2006-04-27
Last Modified: 2010-08-05

I am working on a sample application of Remote Object. It works
if I don't have parameters passed in calling the object, i.e., client
can talk to the server. But how to pass a parameter to server's
object? Below is part of the source code in the server:

public static int Main(string [] args) {



typeof(SampleObject), "mysample", WellKnownObjectMode.SingleCall );


Basically I want to pass args into SampleObject, how do I do it?

Thanks for any help.


Question by:jfz2004
    LVL 12

    Expert Comment

    With server activation you can only use default constructors (no parameters) for remote objects. You can use methods of the remote object to pass values to it.

    If you have constructors that receive parameters you may use client activation (create instances of the remote object with Activator.CreateInstance instead of RegisterWellKnownServiceType) but you should be aware of the details of this approach


    Author Comment


    How to use methods of the remote object to pass value?

    Below is the source code for my object:

    public class SampleObject : MarshalByRefObject
    public static DataTable vTable = new DataTable("vTable");

    public string getVTable(string date, int id)

    LVL 12

    Accepted Solution


    In your first post you showed the server part of the application, the one that creates the instance.
    The client who uses this remote object will have a piece of code to register the type, then you will create an instance and call its methods like with any other class:

            ChannelServices.RegisterChannel(new TcpChannel());

            SampleObject  obj = new SampleObject();

     you need here the port number (portNr) used for server activation and ApplicationName specified on the server

    Author Comment

    This is similar to what I am doing. Thanks.
    I will try it over the weekend.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now