mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-16 00:05:53 +01:00
68 lines
1.8 KiB
ObjectPascal
68 lines
1.8 KiB
ObjectPascal
program ProfilingSample;
|
|
|
|
{$APPTYPE CONSOLE}
|
|
|
|
uses
|
|
System.SysUtils,
|
|
MVCFramework,
|
|
MVCFramework.Commons,
|
|
MVCFramework.Signal,
|
|
Web.ReqMulti,
|
|
Web.WebReq,
|
|
Web.WebBroker,
|
|
IdContext,
|
|
IdHTTPWebBrokerBridge,
|
|
MainControllerU in 'MainControllerU.pas',
|
|
WebModuleU in 'WebModuleU.pas', MVCFramework.Logger {MyWebModule: TWebModule};
|
|
|
|
{$R *.res}
|
|
|
|
|
|
procedure RunServer(APort: Integer);
|
|
var
|
|
LServer: TIdHTTPWebBrokerBridge;
|
|
begin
|
|
Writeln('** DMVCFramework Server ** build ' + DMVCFRAMEWORK_VERSION);
|
|
LServer := TIdHTTPWebBrokerBridge.Create(nil);
|
|
try
|
|
LServer.OnParseAuthentication := TMVCParseAuthentication.OnParseAuthentication;
|
|
LServer.DefaultPort := APort;
|
|
LServer.KeepAlive := True;
|
|
|
|
{ more info about MaxConnections
|
|
http://ww2.indyproject.org/docsite/html/frames.html?frmname=topic&frmfile=index.html }
|
|
LServer.MaxConnections := 0;
|
|
|
|
{ more info about ListenQueue
|
|
http://ww2.indyproject.org/docsite/html/frames.html?frmname=topic&frmfile=index.html }
|
|
LServer.ListenQueue := 200;
|
|
|
|
LServer.Active := True;
|
|
WriteLn('Listening on port ', APort);
|
|
Write('CTRL+C to shutdown the server');
|
|
WaitForTerminationSignal;
|
|
EnterInShutdownState;
|
|
LServer.Active := False;
|
|
finally
|
|
LServer.Free;
|
|
end;
|
|
end;
|
|
|
|
begin
|
|
ReportMemoryLeaksOnShutdown := True;
|
|
IsMultiThread := True;
|
|
try
|
|
if WebRequestHandler <> nil then
|
|
WebRequestHandler.WebModuleClass := WebModuleClass;
|
|
WebRequestHandlerProc.MaxConnections := 1024;
|
|
|
|
{ this line allows to use "Profiler" in actions code}
|
|
Profiler.ProfileLogger := Log; {set to nil to disable profiling}
|
|
{ end -- this line allows to use "Profiler" in actions code}
|
|
RunServer(8080);
|
|
except
|
|
on E: Exception do
|
|
Writeln(E.ClassName, ': ', E.Message);
|
|
end;
|
|
end.
|