.NET Framework Bookmark and Share   
 index > .NET Remoting and Runtime Serialization > Problems hosting a remote interface
 

Problems hosting a remote interface

Ok so this one has been killing me.

I have an interface that looks like this

using System;

namespace Shared
{
public delegate void ThreadResponseEventHandler(Boolean response, Object value);
public interface IThreadClass
{
void ChangeValue(Object NewValue);
void ChangeValueWithoutLock(Object NewValue);
string valuEThread { get;}
event ThreadResponseEventHandler response;
void KillLock();
void LockObject();
}
}

and then I have a remote object that hosts a well-known instance of this interface.

Then on the client end I have a class that consumes the iterface like this

...

private Boolean ConnectRemoteServer()
{
try
{
thread = (IThreadClass)Activator.GetObject(
typeof(IThreadClass),
"tcp://10.x.x.xxx:777/ThreadClass");
return true;
}
catch (Exception ex)
{
return false;
}

}
private void button1_Click(object sender, EventArgs e)
{
if (thread ==null)
{
ConnectRemoteServer();
}
Thread newThread = new Thread(thread.LockObject);
try
{
newThread.Start();
}
catch(Exception ex)
{

}
}*


however, when I run the program IgetanunhandledexceptionwhenIdebugpastthestar.Themessageisasfollows...

Attempted to create well-known object of type 'Shared.IThreadClass'. Well-known objects must derive from the MarshalByRefObject class.

Its an interface not a class so I am really confused what am I doing wrong?
WebService4Ever

What do you mean by "well know instance of the interface"? The class implementing the interface should be inherited from MarshalByRefObject.

Sowmy Srinivasan

What do you mean by "well know instance of the interface"? The class implementing the interface should be inherited from MarshalByRefObject.

Sowmy Srinivasan
Excuse me, but is that some sort of an answer? How about some specifics, an example. I am suffering from a similar instance of error and would like some detail to see if I am suffering from the same cause or detect if I should go another direction. Please provide useful information or don't post...
Dodge
Dodge

I agree, that answer is more condescending than helpful. When I run my application it tells me:

“Attempted to create well-known object of type 'i.i'. Well-known objects must derive from the MarshalByRefObject class.?/p>

But the object class DOES derive from MarshalByRefObject. So now what?

WreckingBall2

I agree, that answer is more condescending than helpful. When I run my application it tells me:

“Attempted to create well-known object of type 'i.i'. Well-known objects must derive from the MarshalByRefObject class.?/p>

But the object class DOES derive from MarshalByRefObject. So now what?

WreckingBall2

You can use google to search for other answers

Custom Search

More Threads

• XML Deserialize problem with nullable enum classes
• DCOM C# server
• Can .NET Remoting Help?
• Remoting problem - Client-Activated Objects
• Delegate doesn’t seem to be working in new thread in WPF
• NotSerializable type used within remote method causes serialization exception
• .Net remoting singleton class Issue
• Null Refrence Exception was unhandled{"Object reference not set to an instance of an object."}.
• Question: shared object across SingleCall instance
• suggestion for a remoteable default membership provider