Problem adding a Service object via Remoting

Topics: CAB & Smart Client Software Factory
Mar 2, 2006 at 9:49 AM
originally posted by: ChrisHolmes

Here's an interesting one I ran into today.

I'm obtaining a Service object (interface) via Remoting when one of my Modules loads. At the moment I retrieve the service object I can use it, so I know it works (I can successfully retrieve data from the server via this object).

But when I go to add it to the RootWorkItem.Services.Add<MyInterface>(myServiceObject) I get this exception:

The provided type System.MarshalByRefObject is not compatible with MyProject.Services.Interfaces.MyInterface

Any clues on that one?
Mar 2, 2006 at 1:22 PM
originally posted by: ChrisHolmes

Further investigation:

I am obtaining the proxy object like so:

IEmployeeDataService service = (IEmployeeDataService)Activator.GetObject(typeof(IEmployeeDataService), "stringhere...");

Yet, if I print it out the object type via service.GetType().ToString() the result is "System.MarshaByRefObject." So it's not the CAB that is having problems as my object is being treated as a wrong type from the get-go.

Any idea on why this happens, and how I can fix it?
Mar 3, 2006 at 10:50 AM
originally posted by: ChrisHolmes

Update:

I've been unable to resolve this issue. But - I turned to WCF (Indigo) and was able to abandon Remoting, thus fixing the problem. A netTcpBinding in WCF fixes the problem and my object isn't treated as a type of MarshalByRefObject, so I'm able to add Services to the CAB that are connected through WCF.

If anyone wants details on this let me know.