Just thought I would share some interesting information that has helped
solve my ASP0115 error.
We ported a Win32 apps DLLS to the Web to use in an ASP application, in
delphi apps you can easily raise and catch exceptions, a very standard thing
to do. But Inetinfo.exe really hates these errors being raised and it does
not handle them too well, and it ends in a continous stream of ASP0115
errors until the web service crashes.

To get around this we have used IServerExceptionHandler, a wonderful
invention that allows me to compile an object model to allow the exceptions
to be handled by the OS or hidden and simply logged to a database table. It
is included in each object and created in procedure Initialize;override;. So
whenever an unhandled exception is thrown it now doesn't kill the web
service and I can see what the error is in the db, really good as sometimes
the test environment can't replicate these errors.

So yeah, thought I would share the joy :o) of solving a 2 week problem that
has been killing our production web servers.

Also thanks to Miles for informing me about new info on the Borland site
about debugging IIS under NT, could only ever get PWS on 98 to do this.

http://www.inprise.com/techpubs/delphi/delphi5/dg/wserver.html
Debugging server applications


Appendix
------------------------------------------------------------------------

procedure TMyObject.Initialize;
begin
  inherited Initialize;
  ServerExceptionHandler := TServerExcp.Create;
  fInitialised := true;
end;

------------------------------------------------------------------------
unit ServerExceptionHandler;

interface

uses
  Windows, ComObj, MtsObj, Mtx, ADODB_TLB;


type
  TServerExcp = class(TInterfacedObject, IServerExceptionHandler)
    procedure OnException(
      const ServerClass, ExceptionClass, ErrorMessage: WideString;
      ExceptAddr: Integer; const ErrorIID, ProgID: WideString;
      var Handled: Integer; var Result: HResult);
  end;


implementation

uses SysUtils, CommonFunctions, CommonGeneralFunctions;

{ TServerExcp }

procedure TServerExcp.OnException(const ServerClass, ExceptionClass,
  ErrorMessage: WideString; ExceptAddr: Integer; const ErrorIID,
  ProgID: WideString; var Handled: Integer; var Result: HResult);
var
  c : _Connection;
  SQL, fconnectionString : string;
  count : olevariant;
begin
 try
    c := coConnection.Create;
    fconnectionString := 'UID=test;' +
                        'PWD=test;' +
                        'DSN=' + DefaultDSN + ';';

    c.Open( fconnectionString, '', '', -1);
    SQL := 'INSERT INTO ComServerException (WhenExceptionOccurred,
ServerName,'
               + 'ClassName, ProgId, ExceptionClass, ExceptionMessage,
ExceptionAddress)'
           + ' VALUES (getdate(),''' + GetNameOfServer + ''',''' +
ServerClass + ''','''
           + ProgId + ''',''' + ExceptionClass + ''',' +
StrToSQLStringWithDoubleQuotes(ErrorMessage) + ',' + inttostr(ExceptAddr) +
')';
    c.Execute(  SQL , count, adCmdText );

 finally
    Handled := integer(true); //if true then don't pass the message to the
OS's COM subsystem...
                               //if false then raise the exception normally
    c.Close;
    c := nil;
 end;
end;

end.
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to