Can I use Interface for CAO in Remoting?

馋奶兔 提交于 2019-12-06 13:37:07

I'm not sure I can post a solution to your actual issue. However, I can explain why the code you've posted throws an exception. You are trying to create an instance of an interface type. This cannot be done, an interface contains no implementation. Generically speaking, I believe what you want to do is create the remote object type and the cast it to the interface that you want to be using (assuming the object implements the interface).

You might want to consider using the technique outlined in this MSDN article Implementing Broker with .NET Remoting Using Client-Activated Objects. This pattern uses a SAO factory to create CAOs.

I've used this technique on the job and it works well.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!