delphi2007 教程

delphi2007 教程

首页 新随笔 联系 聚合 管理
  1013 Posts :: 0 Stories :: 28 Comments :: 0 Trackbacks
com+客户端的发布问题? Delphi / Windows SDK/API
http://www.delphi2007.net/DelphiNetwork/html/delphi_20061123115019274.html
请问Com+的客户端发布时要带上哪些文件?。用的是前绑定。tlb已在客户端注册。  
   
  用来开发的机子连接了几台已配置过的服务器端com+组件都正常,所以服务器权限应该没什么问题。  
   
   
  现在的问题是  
  但把客户端发布到其他电脑上就报   Interface   not   supported  
  请问除了注册tlb文件外,还有哪些要注意的?  
  请问Com+的客户端发布时要带上哪些文件?

可能是还是权限问题,   2003   中   com+   应用程序   default   是对组件进行强制安全检查的(属性->安全叶),   去掉.     前绑定哈,   有难度,   为什么不用那个   IxxxDisp   绑定?

是2000的  
  默认好像强制安全检查是不钩选的。  
   
  请问     comanche(太可怕)       如何使用   IxxxDisp   接口?

安装到别台机上,   如果用的事务模型是   require   以上的话,   要就要求安装那台机上起用   MSDTC,   那个不是服务版的机基本上是禁用的

服务器应该没问题,因为用来开发的机子,都能正常连接安装了组件的服务器。  
  而且dtc已开启。  
   
  不知道为什么做开发的机子,能连正常连接服务器。而其他客户端不行。。。。  
  客户端(dtc也已开启)  
   
  真的很感谢   comanche(太可怕)   的指导!

用调度接口比较简单的,   如果你用的是   CreateRemoteCOM   就可以直接   as   IxxxDisp  
   
  调度接口不要在客户机注册   tlb,   效率上也不低

你用的是   DCOM/Socket   connection?   你可以试下   socket   connection,   如果   socket   connection   可以   dcom   的不行,   那   100%   是权限问题

能发段动态绑定连接的例程吗?

对了,   是不是用到了   midas?   用到的话还要在新安装的那台机上注册   midas.dll

没有用到midas。非数据应用。

这段例子很多啊,   像   master   delphi7   中就有,   找给你  
   
      IFirstServer   =   interface(IDispatch)  
          ['{89855B42-8EFE-11D0-98D0-444553540000}']  
          procedure   ChangeColor;   safecall;  
          function   Get_Value:   Integer;   safecall;  
          procedure   Set_Value(Value:   Integer);   safecall;  
          property   Value:   Integer   read   Get_Value   write   Set_Value;  
      end;  
   
  Then   comes   the   dispinterface,   which   associates   a   number   with   each   element   of   the   IFirstServer   interface:    
   
  type  
      IFirstServerDisp   =   dispinterface  
          ['{89855B42-8EFE-11D0-98D0-444553540000}']  
          procedure   ChangeColor;   dispid   1;  
          property   Value:   Integer   dispid   2;  
      end;  
   
  The   last   portion   of   the   file   includes   a   creator   class,   which   is   used   to   create   an   object   on   the   server   (and   for   this   reason   used   on   the   client   side   of   the   application,   not   on   the   server   side):    
   
   
  //   这段是   IDispatch   调用,   后期  
  var  
      MyServer:   Variant;  
  begin  
      MyServer   :=   CoFirstServer.Create;  
      MyServer.ChangeColor;  
  This   code,   based   on   variants,   is   not   very   different   from   that   of   the   first   controller   you   built   in   this   chapter   (the   one   that   used   Microsoft   Word).   Here   is   the   alternate   code,   which   has   the   same   effect:  
   
   
  //   这段是   COM   interface   调用,   前期  
  var  
      IMyServer:   IFirstServer;  
  begin  
      IMyServer   :=   CoFirstServer.Create;  
      IMyServer.ChangeColor;  
  You've   already   seen   how   you   can   use   the   interface   and   the   variant.   What   about   the   dispatch   interface?   You   can   declare   a   variable   of   the   dispatch   interface   type,   in   this   case:  
   
   
  //   IxxxDisp   智能调度接口调用,   也是前期但不绑定  
  var  
      DMyServer:   IFirstServerDisp;  
  Then   you   can   use   it   to   call   the   methods   as   usual,   after   you've   assigned   an   object   to   it   by   casting   the   object   returned   by   the   creator   class:    
   
  //   这地方有点不对,   CoFirstServer   先   as   了   IFirstServer,   没必要  
  DMyServer   :=   CoFirstServer.Create   as   IFirstServerDisp;  
  DMyServer   :=   CreateComObject(Class_FirstServer)   as   IFirstServerDisp;   就好了  
   
  //   CoFirstServer.Create  
  class   function   CoFirstServer.Create:   IFirstServer;  
  begin  
      Result   :=   CreateComObject(Class_FirstServer)   as   IFirstServer;  
  end;  
   
 

你客户机上的建立服务对像的用的是?     CreateRemoteCOMObject,   还是什么麻烦贴上来

整体是这样完成com+对像,然后_tlb.pas     我不是用com组件工程中的那个。  
  而是用delphi导入类库生成的。  
   
  然后在客户端程序中引用导入的_tlb.pas   我不明白com+组件中生成_tlb.pas   的和导入的_tlb.pas   之前有什么区别?  
   
  var  
      iw:   Ixxx;  
  begin  
      iW   :=   Cocom.CreateRemote(serverName);  
      iw.dosomething;  
  end;  
   
  虽然是前绑定但不应该有错。

那两个没区别,   只要   GUID/IID   相同,   函数定义顺序相同就可  
   
  你这样没问题,   后来我更爱用   IxxxDisp   的方法,   手动写   CreateRemoteCOMObject,   不过也不应有问题了  
   
  这样我作得有点机械化了,   有些细节一时想不到,   ...,   帮顶好了

谢谢   comanche(太可怕)   的帮助!!!

谢谢   comanche(太可怕)   的帮助  
  已经搞定了,不知道为什么客户的com+也须要进行配置才可以。

midas在D6使用时需要在客户端注册midas.dll,但D7只要引用midaslib就OK了。

看过comanche(太可怕)的帖子,都写得不错,看来COM+用了满久了

posted on 2009-05-26 17:28 delphi2007 阅读(173) 评论(0)  编辑 收藏 引用
只有注册用户登录后才能发表评论。