windows “传统” COM 和 COM+ 之间的区别(在组件服务中)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2954968/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Difference between "traditional" COM and COM+ (in Component Services)
提问by kizzx2
By the "traditional" way I mean registering the DLL in registry.
通过“传统”方式,我的意思是在注册表中注册 DLL。
There seems to be another method to set up it by going to mmc->Component Services->COM+ Applications and adding the .tlb
file.
似乎还有另一种方法可以通过转到 mmc->Component Services->COM+ Applications 并添加.tlb
文件来设置它。
I have a COM library that supports both methods. When it installs, it registers itself in the registry as a COM component and it works fine. However, when I added the .tlb
file using the Component Services method, the behavior seems to be different and it starts giving out errors.
我有一个支持这两种方法的 COM 库。当它安装时,它在注册表中将自己注册为一个 COM 组件并且它工作正常。但是,当我.tlb
使用 Component Services 方法添加文件时,行为似乎有所不同,并且开始出现错误。
I suspect it has something to do with marshaling and inter-process object transfer? (Sorry, I'm really a noob in the COM area)
我怀疑它与编组和进程间对象传输有关?(对不起,我真的是COM领域的菜鸟)
Can anyone point me to a good resource to clear my understanding?
谁能给我指出一个很好的资源来清除我的理解?
回答by Vagaus
COM+ (Component Services) provides a lot of infrastructure out of the box; for instance COM+ provides transaction, security, object pooling and some other services.
COM+(组件服务)提供了很多开箱即用的基础设施;例如 COM+ 提供事务、安全、对象池和其他一些服务。
When you register a COM component under COM+ it will run "Out Of Process"; in this mode you are guaranteed to have a proxy between your COM server and its clients.
当您在 COM+ 下注册 COM 组件时,它将运行“进程外”;在这种模式下,你可以保证在你的 COM 服务器和它的客户端之间有一个代理。
The best place I can think of for learning more about COM+ is the official MS site: http://msdn.microsoft.com/en-us/library/ms685978(VS.85).aspx
我能想到的了解 COM+ 的最佳地点是 MS 官方网站:http: //msdn.microsoft.com/en-us/library/ms685978(VS.85).aspx
回答by valdo
Agree with the previous post.
同意之前的帖子。
One thing to add: actually registering the type library (.tlb file) is normal for COM as well, not only for COM+. The type library is generated automatically by IDL compiler. It contains a description of your interfaces and objects.
补充一点:实际注册类型库(.tlb 文件)对于 COM 也是正常的,不仅对于 COM+。类型库由 IDL 编译器自动生成。它包含对您的接口和对象的描述。
So that you can "import" your COM component into some project, and the definition of the interfaces and objects are visible.
这样您就可以将您的 COM 组件“导入”到某个项目中,并且接口和对象的定义是可见的。