问题描述
什么是现代相当于实现一体化(即Excel的类型的自动化目的)二.NET应用程序?
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?
例如,如果你暴露通过COM .NET应用程序的API,你可以得到一个运行时引用该应用程序在你的COM客户端,并得到事件回调,调用方法,等等。
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.
有没有现代技术,适用于这两.NET应用程序之间?据我所知,.NET远程或WCF(即通过命名管道) - ?有什么新/更好
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?
推荐答案
国际海事组织,这将是一个矫枉过正使用WCF的两个桌面应用程序之间进行通信的一样的计算机。
IMO, it would be an overkill to use WCF for communicating between two desktop applications on the same computer.
我宁愿使用任何的或者干脆的 / RevokeActiveObject
注册服务器应用程序对象。然后,因此,我会使用腐烂的获得COM代理从客户端应用程序这个对象。
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.
有关沟通,我会使用哪个COM IPC编组可以名帅一些标准的COM接口不注册类型库(不需要 RegAsm
)。例如, IOleCommandTarget
或自定义调度接口( ComInterfaceType.InterfaceIsIDispatch
,它映射到非双的IDispatch
)。
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
).
媲美WCF,这可以以最小的开发力度和运行时开销完成。
Comparable to WCF, this can be done with minimal development efforts and runtime overhead.
这篇关于现代.NET相当于COM互操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!