Modern .NET equivalent for COM interop

孤者浪人 提交于 2019-12-23 23:08:54

问题


What is the modern day equivalent to achieve COM interop type of integration (i.e. for Excel type of automation purposes) between two .NET applications?

For example, if you expose a .NET application API via COM, you are able to get a runtime reference to that application in your COM client and get event callbacks, call methods, etc.

Is there a modern day technology suited for this between two .NET applications? I understand there is .NET Remoting or WCF (i.e. via named pipes) - is there anything newer/better?


回答1:


IMO, it would be an overkill to use WCF for communicating between two desktop applications on the same computer.

I'd rather use either ROT or simply RegisterActiveObject/RevokeActiveObject to register the server application object. Then, accordingly, I'd use ROT or GetActiveObject to obtain a COM proxy to this object from the client application.

For communicating, I'd use some standard COM interfaces which COM IPC marshaller can marshal without registering a type library (no need for RegAsm). E.g., IOleCommandTarget or a custom dispinterface (ComInterfaceType.InterfaceIsIDispatch, which maps to a non-dual IDispatch).

Comparable to WCF, this can be done with minimal development efforts and runtime overhead.



来源:https://stackoverflow.com/questions/23958943/modern-net-equivalent-for-com-interop

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