Forum > Networking and Web Programming

FCGI + IIS issue

(1/1)

egsuh:
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  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---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 := '<table>';      First;      while not eof do begin         Result += '<tr>';         for Field in Fields do begin            Result += Format('<td>%s</td>', [Field.AsString]) ;         end;         Result += '</tr>';         Next;      end;      Result += '</table>';      (Transaction as TSQLTransaction).Rollback;   end;end;  procedure Hello(ARequest: TRequest; AResponse: TResponse);begin   cnt += 1;   AResponse.Content := 'Count: ' + IntToStr(cnt) + '<br>';   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  :D

Hope the developers may give some insights if possible.

egsuh:
Sorry. Still error happens, but rather infrequently. About after processing 50 requests.

Leledumbo:
Compile -gl and see the stacktrace when the exception occurs.

Navigation

[0] Message Index

Go to full version