开发者

Exposing a C# COM interface via a C# Windows Service

开发者 https://www.devze.com 2023-04-12 12:27 出处:网络
I\'m looking to tie up a legacy app with a newer C# component which runs as a Windows service. The legacy app uses COM to call out to retrieve some diagnostics data from an interface we have in other

I'm looking to tie up a legacy app with a newer C# component which runs as a Windows service. The legacy app uses COM to call out to retrieve some diagnostics data from an interface we have in other legacy apps. Because I'm unable to heavily modify the lega开发者_JAVA百科cy app, what I'd like to be able to do is to expose the same COM interface from my new C# Windows service so the diagnostic information can be recovered. It's complicated a bit as the Windows service will need to load the class implementing the COM interface via an IoC so it doesn't really know it's even hosting a COM interface.

So far I've been able to replicate the COM interface in a class library, register it fine, and call it from a C++ test harness. However, when the library is referenced by the C# Windows service, the running instance of the implementing class isn't the one called. Does anyone know of a way to achieve this? It feels like I need to do something like in C++ by registering the implementing class at runtime, but I'm not sure how to do this.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号