FCGI + IIS issue lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- egsuh · 2023-02-05 08:49 Hope that those interested in web programming remember I have posted several threads regarding FCGI's rasing exceptions under IIS. Now there seems to be a possibility that this is caused by TDataModule or TWebmodule. Now I have made a fcgi application not using webmodule nor datamodule. Following is the codes. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit ufcgi2; {$mode ObjFPC}{$H+} interface uses   Classes, SysUtils,  httpdefs, fpHTTP, fpWeb, httproute,   IBConnection, SQLDB; var   IBConnection1: TIBConnection;   SQLQuery1: TSQLQuery;   SQLTransaction1: TSQLTransaction;    function TestContent: string;   procedure Hello (ARequest:TRequest; AResponse: TResponse); implementation uses DB; var   cnt : integer = 0; function TestContent: string;var   Field: TField;begin   with SQLQuery1 do begin      SQL.text := 'Select * from TEST';      Transaction.Active := True;      Open;       Result := '';      First;      while not eof do begin         Result += '';         for Field in Fields do begin            Result += Format('', [Field.AsString]) ;         end;         Result += '';         Next;      end;    Result += '
%s
';      (Transaction as TSQLTransaction).Rollback;   end;end;  procedure Hello(ARequest: TRequest; AResponse: TResponse);begin   cnt += 1;   AResponse.Content := 'Count: ' + IntToStr(cnt) + '
';   AResponse.Content := AResponse.Content + TestContent;end; initialization    ibconnection1 := TIBConnection.Create(nil);    with ibconnection1 do begin       DatabaseName:= 'd:\DBS\aq03.fdb';       Username := 'sysdba';       Password := 'masterkey';       Connected := True;    end;    sqltransaction1 := TSQLTransaction.Create(nil);    SQLTransaction1.DataBase := ibconnection1;     sqlquery1 := TSQLQuery.Create(nil);    sqlquery1.DataBase := ibconnection1;     HTTPRouter.RegisterRoute('*', @Hello);finalization   ibconnection1.connected := False;   SQLQuery1.Free;   SQLTransaction1.Free;   ibconnection1.Free; end.  Originally DB-related components were in a separate DataModule. With TDataModule, it causes errors after about 15~20 requests (by pressing F5). But with the new approach listed above, I cannot cause the error how fast I press F5  Hope the developers may give some insights if possible. ---------------------------------------------------------------------- egsuh · 2023-02-05 08:52 Sorry. Still error happens, but rather infrequently. About after processing 50 requests. ---------------------------------------------------------------------- Leledumbo · 2023-02-13 02:22 Compile -gl and see the stacktrace when the exception occurs.