Home Server

WebTier Debug ??

edited April 2004 in Server
While migrating a WebTier Client that follows the same idea as the Debug
Demo (a Dll & a Exe) i'm having some problems.
The migration is from D6.2 to D7.

I've changed then port from 1024 to 8081, the app (when in exe-mode) starts
normally. When starting the WebAppDebugger i see the application in the
list.
When selecting it and pressing to go button i'm always getting a
EOleSysError 'CoInitialize has not been called'.
I've compared my code with the code in the RB7.03 for D7 demo and i can't
find any difference ??

Any suggestion on this ?

Comments

  • edited April 2004
    Even adding this code

    CoInitFlags : longint;
    begin
    CoInitFlags:= COINIT_MULTITHREADED or COINIT_SPEED_OVER_MEMORY;
    CoInitializeEx(nil, CoInitFlags);

    In the Webmodule create doesn't help.
  • edited April 2004

    I just tried an experiment. I used Delphi 7 to open and run the WebDebug
    demo installed for Delphi 6. I only had to modify the
    the WebTier.WebModuleURI for the 8081 port used by the D7 WebDebugger. It
    compiles and runs fine.

    Try doing the same.

    You can also try adding '$(DELPHI)\Lib\Debug' to the front of your library
    path. The compile and run with the debugger set to break on Delphi language
    exceptions. Perhaps that will help determine where the problem is.

    In the standard WebDebug demos is not necessary to call CoInitialize. In
    other parts of ReportBuilder, such as the threading and windows service,
    CoInitialize is called for each thread to enable to COM to be used. This is
    necessary for using ADO, etc. For each call to CoInitialize there must be a
    call to CoUnitialize.

    Here is an example from RBuilder\Source\ppBackgroundThread.....



    procedure TppBackgroundPrintThread.Execute;
    begin

    CoInitialize(nil);

    try

    try
    GenerateReport;

    except
    on E: Exception do
    Terminate;
    end;

    finally
    CoUnInitialize;

    end;

    end;




    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2004
    Nard, ive placed both instruction in the create/destroy of the webmodule and
    even in the before/after dispatch.
    I'm still getting this error. And yes, i'm using in the webmodule ado
    components for security checking.
    The selections for the autosearch values are different for each user.

    This is my call stack, hope this is clear to you

    OleError(-2147221008)
    OleCheck(-2147221008)
    CreateADOObject((1300, 0, 16, (128, 0, 0, 170, 0, 109, 46, 164)))
    TADOConnection.Create($C599E8)
    CreateComponent
    TReader.ReadComponent(nil)
    TReader.ReadDataInner($C599E8)
    TReader.ReadData($C599E8)
    TComponent.ReadState($C59B98)
    TDataModule.ReadState($C59B98)
    TReader.ReadRootComponent($C599E8)
    TStream.ReadComponent($C599E8)
    InternalReadComponentRes('TwmMain',4194304,$C599E8)
    InitComponent(TwmMain)
    InitInheritedComponent($C599E8,TCustomWebDispatcher)
    TWebModule.Create(nil)
    TDefaultWebModuleFactory.GetModule
    TWebModuleList.AutoCreateModules
    TWebRequestHandler.HandleRequest($C59834,$C59854)
    TSockWebRequestHandler.Run(TSockWebRequestAccess($C5981C) as
    ISockWebRequestAccess)
    TWebRequestDataBlockInterpreterHandleRequest.DoHandleRequest(TDataBlock($C59
    7B0) as IDataBlock)
    TWebRequestDataBlockInterpreter.InterpretData(TDataBlock($C597B0) as
    IDataBlock)
    TWebRequestListener.ServerExecute($C57F30)
    TIdTCPServer.DoExecute($C57F30)
    TIdPeerThread.Run
    TIdThread.Execute
    ThreadProc($C57F30)
    ThreadWrapper($C5692C)
  • edited April 2004

    As a test, try creating a Delphi WebModule that does not use the WebTier or
    any other RB components. Just use your ADO components.

    As another test use the WebTier without your ADO components.

    I think the issue here is how to use ADO components in a Delphi WebModule. I
    searched Google Groups and there is much discussion on this subject. Based
    upon what I read, I think you need to use the WebModuel.BeforeDispatch and
    AfterDispatch methods. Make sure that the ADOConnection and any ADO datasets
    are set to Active = False so that nothing will be fired when the components
    are read up.

    If that still does not work. Then I would place the ADO components on a
    separate DataModule that Create/Free only as needed. Then you can make the
    CoInitialize/CoUnitialize prior to instantiating the DataModule. You can
    call methods on the DataModule and then Free it and CoUnitialize.




    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.