Using Matlab desktop with .NET remoting
14 次查看(过去 30 天)
显示 更早的评论
Hello,
I'm having an issue trying to use Matlab with .NET remoting. I have a (non-matlab) .NET module that starts a remoting server. I have a separate DLL module that defines a class (ObjectGetter) with a function (GetProxy) that connects to the remoting server and returns the retrieved remote object as an .NET Interface (IMatRemoting). I have a 3rd DLL modules that defines the interface used by the remote object.
The remote server is running.
In Matlab desktop, I do the following:
NET.addAssembly('path to ObjectGetter class DLL');
NET.addAssembly('path to Interface DLL');
getter = ObjectGetterNameSpace.ObjectGetter;
proxy = getter.GetProxy();
None of this gives me any errors, but "proxy" is returned as a "MarshaByRefObject" instead of an "IMatRemoting" object. Therefore, I cannot call any methods on the remote object (since MarshalByRefObject doesn't have any of those methods). The "GetProxy" function return type is "IMatRemoting", so I'm not sure why the returned objects is being stored as MarshalByRefObject.
When I do the same thing using WCF, the returned object IS "IMatRemoting" and I CAN call its methods and get valid results. However, due to some limitations of WCF, I cannot use it and have to use Remoting.
The definition of "GetProxy" is below. I would really appreciate you help on this.
public IMatRemoting.IMatRemoting GetProxy()
{
IpcChannel ipcCh = new IpcChannel("myClient");
ChannelServices.RegisterChannel(ipcCh, false);
return (IMatRemoting.IMatRemoting)Activator.GetObject(typeof(IMatRemoting.IMatRemoting), "ipc://MatRemotingServer/MatRemoteObject");
}
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!