问题
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