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

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

问题描述

COM / ActiveX的一个好处是out-of-process 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:


  • A DLLHost过程

  • A服务

  • 一个inproc库(这与其他代码在同一个进程中)

互联网关于这些。原因是:

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


  • 使用接口装饰您需要暴露给COM的类

  • 您要托管的组件需要从ServicedComponent派生

  • 使用GuidAttribute装饰您的接口(使用唯一的Guid)

  • 装饰使用ComVisible(true)属性公开给COM的接口和类

  • Decorate your classes that you need to expose to COM with Interfaces
  • Components that you want to host need to be derrived from ServicedComponent
  • Decorate your interfaces with a GuidAttribute (use a unique Guid)
  • Decorate the interfaces and classes that are exposed to COM with a ComVisible(true) attribute

希望这有助于。

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

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