.NET 中是否有相当于进程外 COM EXE 的功能? [英] Is there an equivalent to out-of-process COM EXE in .NET?

查看:12
本文介绍了.NET 中是否有相当于进程外 COM EXE 的功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

COM/ActiveX 的优点之一是进程外 EXE.您可以有一个 EXE,它以一种其他进程(包括 VBScript 和 JScript)都可以使用的形式公开方法和属性.同时,EXE 可以有自己的功能,与它的类型库公开的功能相关或无关.

One of the nice things about COM/ActiveX was the out-of-process EXE. You could have an EXE which exposed methods and properties in a form usable by both other processes, including VBScript and JScript. At the same time the EXE could have its own functionality, related or unrelated to that exposed by its type library.

.NET 等价物是什么?

What is the .NET equivalent?

我有一个现有的 VB6 项目,它是一个脚本语言解释器(使用 MSScript)和其他脚本语言的各种工具功能的资源.有人建议我尝试将其转换为 .NET.

I have an existing VB6 project which is a scripting language interpreter (using MSScript) and a resource of various tool functions for other scripting languages. It has been suggested that I try converting it to .NET.

这行得通吗,还是我最终会将一件物品分成两份?

Is this going to work, or will I end up splitting the one item into two?

推荐答案

企业服务将允许您这样做.您可以将 COM 组件运行为:

Enterprise services will allow you to do just that. You can run a COM component as:

  • 一个 DLLHost 进程
  • 一项服务
  • 一个 inproc 库(这与您的其他代码在同一进程中)

互联网上有很多关于这些的例子.归根结底是:

There are numerous examples on the internet about these. What it comes down to is:

  • 使用接口装饰您需要向 COM 公开的类
  • 您要托管的组件需要从 ServicedComponent 派生
  • 使用 GuidAttribute 装饰您的界面(使用唯一的 Guid)
  • 使用 ComVisible(true) 属性装饰向 COM 公开的接口和类

希望这会有所帮助.

这篇关于.NET 中是否有相当于进程外 COM EXE 的功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆