Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot load type error, .Net Remoting

Tags:

.net

remoting

i am trying to make a simple program that sends an id as an int and gets the data according to id. But i keep getting this error.

Cannot load type 'remote.RemoteObjectClass, remoteclient, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

Server

        TcpServerChannel channel = new TcpServerChannel(8086);
        ChannelServices.RegisterChannel(channel);

        RemotingConfiguration.RegisterWellKnownServiceType(typeof(Class1), "1",
        WellKnownObjectMode.Singleton);
        label1.Text = "started";

Client

RemoteObjectClass obj1 = (RemoteObjectClass)Activator.GetObject(
       typeof(RemoteObjectClass),
       "tcp://localhost:8086/1");

        if (obj1 == null)
        {

            label1.Text = "Could not locate TCP server";

        }
        Class1 cl = obj1.kk(Convert.ToInt32(textBox1.Text)); -- **got error here**

RemoteObjectClass

class RemoteObjectClass : System.MarshalByRefObject
{

    public int c(int i)
    {
        return 33;
    }
    public Class1 kk(int i)
    {
        Class1 k = new Class1();
        return k;
    }

ClassLibrary

namespace ClassLibrary1
{
    public class Class1 : System.MarshalByRefObject

    {
        public string ad;

        public int id;
    }
}
like image 720
Koray Avatar asked Apr 02 '11 11:04

Koray


1 Answers

This error may happen if the Caller and Called RemoteObject Classes are in different namespaces.

like image 72
benjamin Avatar answered Sep 19 '22 05:09

benjamin