我想模仿 VB6-Active-X-Exe 的行为。
为此,我创建了一个新项目并将其设置设置为“COM Visible=True”。
我现在可以将此 .exe 添加到我的主应用程序中,我可以调用它,调用该 .exe 中的函数等。
但是,我认为这并没有真正脱离过程。
因此,我想对此类 .exe 的行为进行更多调查。但是我没有找到任何官方文档。
有人可以告诉我在哪里可以找到更多信息吗?
谢谢!
我想模仿 VB6-Active-X-Exe 的行为。
为此,我创建了一个新项目并将其设置设置为“COM Visible=True”。
我现在可以将此 .exe 添加到我的主应用程序中,我可以调用它,调用该 .exe 中的函数等。
但是,我认为这并没有真正脱离过程。
因此,我想对此类 .exe 的行为进行更多调查。但是我没有找到任何官方文档。
有人可以告诉我在哪里可以找到更多信息吗?
谢谢!
Out-of-process COM servers (ActiveX EXE's) are not as easy to create with VB.NET as they were with VB6. When you reference a .NET executable (as a .NET assembly reference, not as a COM reference) from another .NET project, it always treats it as in in-process library. The .NET Framework has no direct equivalent to COM's out-of-process servers. Typically, in such scenarios, it is recommended that you create a WCF service, a web service, or use .NET remoting. WCF services are preferred since they use the most modern technology of the three.
However, since .NET supports COM interoperability, it is technically possible to create a .NET executable which can be registered as a out-of-process COM server. Then, when another .NET project references it via COM (rather than as a .NET assembly reference) it will run out-of-process. Microsoft provides an example of how to do that here.
However, if you don't need it to be COM (so that it can be used by non-.NET applications), I would recommend that you go the pure .NET WCF service route.