请教 Com 开发问题(50分)

  • 主题发起人 HammerLi
  • 开始时间
H

HammerLi

Unregistered / Unconfirmed
GUEST, unregistred user!
我做了一个 Com 服务器,在 ActiveX Library 中加了一个 Com Object,客户端程序
使用 CreateRemoteObject 在本机调用成功,但是到其他机器上就报“类没有注册”
或“无法写入注册表”的错误,是不是 Com 组件需要在两端都注册?如何注册客户端?
Automation Object 也一样。
 
在其它机器上使用regsvr32 xxxx.ocx(你的ActiveX Library名)
 
to HammerLI:
你应该进行注册。你的设想是对的,都要进行注册。
进行内的 COM,可以用TSEGSVR +X.DLL.
也可以使用Windwos的regsrv32.exe注册。
 
也就是说要将 Com 服务器拷贝到客户端?那调用的时候实际是在远程机器上还是
本地机器上?
 
to HammerLi:
注册的目的,是在注册表中记载该 服务器的位置,以便在用户调用时,
找到该服务器。
调用的时候,如果客户端调用coCreateRomote()的话,是启动远程机器上的 COM。
 
只需要服务端的TLB文件即可
 
需要在客户端先进行注册
 
to:HammerLi
建议你先看几本关于Com的书。
COM有进程内Com和进程外com之分,进程内Com的载体为Dll,系统使用Rundll32。exe
启动进程内com,这种类型的com只能在本机调用。
进程外com的载体为exe,由于delphi的封装,进程外com实现了Dcom的Romote调用功能
(Rpc),然而需要Dcom配置。
至于com+则使用dllhost。exe 加载,支持Dcom调用。
Automation Object 是接口的绑定形式。
 
对于 Com/Dcom 我了解的不太多,个个书籍上介绍的也不多,介绍几本好书啊!
我在北京,那个MTS/COM什么的在那儿有卖的啊?好像以前的书不太好买到了。
另外进程外COM才支持Remote调用那岂不是有多少的客户端就要有多少个EXE执行?
太费资源了吧!如何创建COM+的对象?
 
错,是一个EXE执行,其中运行COM对象的多个实例。
 
两端都要注册,客户端运行时具体调用哪一个在客户端
程序里可以设定的。
 
我看了看李维的MTS/ADO/COM+开发指南,大概有了个了解,可是我在Win 2000下用组件服务
生成客户端安装程序的.MSI安装程序为什么总是不能执行啊,一运行就抱错说不能注册,
应该怎么做?另外如果用其它的安装程序制作的话,比如InstallShield,大家知不知道如
何制作啊?
 
[purple]关于生成客户端安装程序的.MSI
1.先在同一台电脑上调试完成程序
2.在服务器组件管理中删除该项目。
3.新建立一个项同应用程序
4.在其组件项上右击,新建组件
5.选择新安装组件,选择全部Com+的dll和tlb文件。
6.导出客户安装msi,在客户端安装即可。[/purple]
 
To hujunx:
你的方法我试过了,不行。在客户端安装的时候还是报"Error registring COM+ Application"
你试过吗?有没有其他的条件,例如服务器环境,我的是中文版 Server + SP2。
 
OK, 其它问题再发贴!
 
客户端msi文件比较小,你可以生成2个msi文件,比较大小。
我的dll文件有30M,可是客户端msi只有不到1M.
我的编程环境是win2000P+sp2、Delphi6,SQL Server,
我上面的方法的原则是 :
全新安装Com+组件,包括类型库(TLB),然后导出。你的操作可能有问题,
选择TLB文件没有?
该方法微软网站有解释:
HOWTO: Create a COM+ Application Proxy That Installs Only Type Library Files (Q292184)

The information in this article applies to:
· Microsoft COM+, versions 1.0 , 1.5 , , used with:
o the operating system: Microsoft Windows 2000 SP2
o the operating system: Microsoft Windows XP

SUMMARY
COM+ application proxies usually install the component dynamic link libraries (DLLs) on client computers because the DLLs contain the type library files that are needed to support the component's interfaces in addition to the component code. Only the type library that is contained in the DLL is used on the client computer;
the component code is not used. The objects still run on the remote COM+ server as expected.
This article explains how you can have a COM+ application proxy install only a type library file (.tlb) that supports your component interfaces instead of the entire DLL. This file contains only the type library and none of the component code.
MORE INFORMATION
Step-by-Step Example
NOTE : Windows 2000 Service Pack 2 or later must be installed on the COM+ application server computer for this procedure to work correctly.
1. Generate the type library files for your component DLLs, and ensure that the .tlb file is built in the same folder as the .dll file:
o For a Microsoft Foundation Classes (MFC) or Microsoft Active Template Library (ATL) DLL, the .tlb file is built by default.
o For a Microsoft Visual Basic DLL, select the Remote Server Files check box on the Component tab of the Project Properties dialog box, and then
build the DLL.
2. Install both the component .dll and the typelib .tlb file into your COM+ application at the same time. Todo
this, you must select the Install new component(s) option and then
select both files together in the Select files to install dialog box when you install your component in the COM+ application.
NOTE : If you already installed the .dll file separately, you must delete the component and install the files together.
3. Export the application proxy.
4. Run the resultant .msi on the client computers. Notice that only the .tlb files are copied to the client computer.
NOTE : There is a known problem when you run the application proxy on Windows 95-based, Windows 98-based, or Windows NT 4.0-based computers. For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
Q289821 FIX: COM+ Application Proxydo
es Not Register CLSID After You Install COM+ Rollup Hotfix 5
REFERENCES
For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
Q255973 FIX: Exporting Application Proxy in COM+ Gives Export Application Error

 
顶部