组件写好了,在本机测试没有问题,拿到别的机器上在createobject时就没有反应了,
整个IIS都好象停止响应,不接受任何ASP请求

解决方案 »

  1.   

    补充一下 应该是IIS的Application自动重起
    代码马上贴
      

  2.   

    library MyOle;uses
      ComServ,
      Unit1 in 'Unit1.pas' {Myobj: CoClass},
      MyOle_TLB in 'MyOle_TLB.pas';exports
      DllGetClassObject,
      DllCanUnloadNow,
      DllRegisterServer,
      DllUnregisterServer;{$R *.TLB}{$R *.RES}begin
    end.---------unit Unit1;
    interfaceuses
      ComObj, ActiveX, AspTlb, MyOle_TLB, StdVcl;type
      TMyobj = class(TASPObject, IMyobj)
      private
      protected
        procedure OnEndPage; safecall;
        function OnStartPage(const Punk: IUnknown): Integer; safecall;
        function GetData(const Str: WideString): WideString; safecall;
      end;implementationuses ComServ;procedure TMyobj.OnEndPage;
    begin
      //inherited OnEndPage;
    end;function TMyobj.OnStartPage(const Punk: IUnknown): Integer;
    begin
    //
    end;function TMyobj.GetData(const Str: WideString): WideString;
    begin
         RESULT:=Str;
    end;initialization
      TAutoObjectFactory.Create(ComServer, TMyobj, Class_Myobj,
        ciMultiInstance, tmApartment);
    end.--------unit MyOle_TLB;// ************************************************************************ //
    // WARNING                                                                    
    // -------                                                                    
    // The types declared in this file were generated from data read from a       
    // Type Library. If this type library is explicitly or indirectly (via        
    // another type library referring to this type library) re-imported, or the   
    // 'Refresh' command of the Type Library Editor activated while editing the   
    // Type Library, the contents of this file will be regenerated and all        
    // manual modifications will be lost.                                         
    // ************************************************************************ //// PASTLWTR : 1.2
    // File generated on 2003-12-12 14:44:39 from Type Library described below.// ************************************************************************  //
    // Type Lib: C:\ASP组件\新建文件夹 (2)\MyOle.tlb (1)
    // LIBID: {C0AFE794-15D5-44AB-9C93-8CD2AE4F30B2}
    // LCID: 0
    // Helpfile: 
    // HelpString: MyOle Library
    // DepndLst: 
    //   (1) v2.0 stdole, (C:\WINNT\System32\stdole2.tlb)
    // ************************************************************************ //
    {$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers. 
    {$WARN SYMBOL_PLATFORM OFF}
    {$WRITEABLECONST ON}
    {$VARPROPSETTER ON}
    interfaceuses Windows, ActiveX, Classes, Graphics, StdVCL, Variants;
      // *********************************************************************//
    // GUIDS declared in the TypeLibrary. Following prefixes are used:        
    //   Type Libraries     : LIBID_xxxx                                      
    //   CoClasses          : CLASS_xxxx                                      
    //   DISPInterfaces     : DIID_xxxx                                       
    //   Non-DISP interfaces: IID_xxxx                                        
    // *********************************************************************//
    const
      // TypeLibrary Major and minor versions
      MyOleMajorVersion = 1;
      MyOleMinorVersion = 0;  LIBID_MyOle: TGUID = '{C0AFE794-15D5-44AB-9C93-8CD2AE4F30B2}';  IID_IMyobj: TGUID = '{B07CC87B-C9A5-4D75-A68F-DE1CB7DC75B3}';
      CLASS_Myobj: TGUID = '{EC2D4951-8142-4FA5-9949-FD7B4F13EF8A}';
    type// *********************************************************************//
    // Forward declaration of types defined in TypeLibrary                    
    // *********************************************************************//
      IMyobj = interface;
      IMyobjDisp = dispinterface;// *********************************************************************//
    // Declaration of CoClasses defined in Type Library                       
    // (NOTE: Here we map each CoClass to its Default Interface)              
    // *********************************************************************//
      Myobj = IMyobj;
    // *********************************************************************//
    // Interface: IMyobj
    // Flags:     (4416) Dual OleAutomation Dispatchable
    // GUID:      {B07CC87B-C9A5-4D75-A68F-DE1CB7DC75B3}
    // *********************************************************************//
      IMyobj = interface(IDispatch)
        ['{B07CC87B-C9A5-4D75-A68F-DE1CB7DC75B3}']
        function OnStartPage(const Punk: IUnknown): Integer; safecall;
        procedure OnEndPage; safecall;
        function GetData(const Str: WideString): WideString; safecall;
      end;// *********************************************************************//
    // DispIntf:  IMyobjDisp
    // Flags:     (4416) Dual OleAutomation Dispatchable
    // GUID:      {B07CC87B-C9A5-4D75-A68F-DE1CB7DC75B3}
    // *********************************************************************//
      IMyobjDisp = dispinterface
        ['{B07CC87B-C9A5-4D75-A68F-DE1CB7DC75B3}']
        function OnStartPage(const Punk: IUnknown): Integer; dispid 1;
        procedure OnEndPage; dispid 2;
        function GetData(const Str: WideString): WideString; dispid 3;
      end;// *********************************************************************//
    // The Class CoMyobj provides a Create and CreateRemote method to          
    // create instances of the default interface IMyobj exposed by              
    // the CoClass Myobj. The functions are intended to be used by             
    // clients wishing to automate the CoClass objects exposed by the         
    // server of this typelibrary.                                            
    // *********************************************************************//
      CoMyobj = class
        class function Create: IMyobj;
        class function CreateRemote(const MachineName: string): IMyobj;
      end;implementationuses ComObj;class function CoMyobj.Create: IMyobj;
    begin
      Result := CreateComObject(CLASS_Myobj) as IMyobj;
    end;class function CoMyobj.CreateRemote(const MachineName: string): IMyobj;
    begin
      Result := CreateRemoteComObject(MachineName, CLASS_Myobj) as IMyobj;
    end;end.
      

  3.   

    问个傻问题:拿到别的机器上在createobject时就没有反应了如何拿的?
      

  4.   

    如何拿的?
    回答:
    上传编译好的DL,并注册
    PS:公司的服务器注明一下:
    我的开发机是WIN2K FAT32,服务器是NTFS
    与这个有关?
      

  5.   

    操作系统的权限依赖于文件系统
    fat fat32的分区没有权限可言,nt在fat分区下未能控制权限仅仅是密码。
    但是ntfs不一样了,每个文件每个目录都有独立的读 写 执行  等等权限控制会不会是你需要访问的组件没有合适的权限?iis的asp调用的任何一个com组件对应的dll文件最起码都要有IUSR_机器名 IWAN_机器名
    这两个帐号的读权限,你设置对了吗?
      

  6.   

    设置了
    直接用ASP访问该组件导致DLLHOST异常
    偶自己重新拿了块硬盘全部用NTFS分区并重装WIN2K SERVER,测试后也正常可拿到公司服务器上就出现DLLHOST异常,一开始我就怀疑可能是WINDOWS SCRIPT版本问题 于是升级,问题依然得不到解决。
    更奇怪的是,我在网上找到一个delphi写的多文件快速上传的COM,附source的,他里面有自己编译好的DLL,我拿到出问题的那台机器上注册,用ASP调用,结果:正常。然后把他的代码重新编译一次,再拿到那台机器上,问题又出现了。偶不明白。
      

  7.   

    呵呵 
    问题找到了
    这2天到处找资料 发现 只要请把Tools->Environment options->Type Library->Language设为Pascal就好了
      

  8.   

    默认是IDL的 难道那个设置影响了参数的传递格式?