Hervé Posted May 28, 2025 Posted May 28, 2025 Hello, I've build my service : program Project1; uses SvcMgr, ServerModule in 'ServerModule.pas' {UniServerModule: TUniGUIServerModule}, MainModule in 'MainModule.pas' {UniMainModule: TUniGUIMainModule}, Main in 'Main.pas' {MainForm: TUniForm}, ServiceModule in 'ServiceModule.pas' {UniServiceModule: TUniGUIService}; ...other units here... {$R *.res} begin if not Application.DelayInitialize or Application.Installing then Application.Initialize; Application.CreateForm(TUniServiceModule, UniServiceModule); Application.Run; end. And in my ServiceModule I've placed : procedure TUniServicePFAC.ServiceStart(Sender: TService; var Started: Boolean); begin TUniServerModule.Create(Application); Started := True; end; Is it the correct way ? I've notice that if I don't place : TUniServerModule.Create(Application); Even if the service is running, In the browser with http://192.XXX.XXX.XX:8077 can't connect to the application.... Big thank you in advance for your help. With best regards, Hervé
Sherzod Posted May 28, 2025 Posted May 28, 2025 Hello, Manually calling TUniServerModule.Create(Application) in ServiceStart is not the correct way to initialize a uniGUI service application. uniGUI is designed to handle the server module lifecycle internally. When you use a proper TUniGUIService-based project structure, the server module is created automatically during Application.Initialize, as long as SetServerClass(UniGUIServerModuleClass) is called in InitService. Creating it manually bypasses the framework's lifecycle management and can lead to instability or unexpected issues (e.g. session handling, port conflicts, etc.). I recommend removing that line and ensuring your project follows the standard uniGUI Windows Service template. 1
Hervé Posted May 28, 2025 Author Posted May 28, 2025 Hello, Thank you for the explication. Ok, I've removed it, but now I've got a message : 192.xxx.xxx.xx:8077 refuse to connect... I don't see what's wrong... with best regards, Hervé.
Hervé Posted May 28, 2025 Author Posted May 28, 2025 Hello, where I could have a sample of a ServiceModule code that is working fine for an unigui application, please ? Wiht best regards, Hervé
Sherzod Posted May 28, 2025 Posted May 28, 2025 5 minutes ago, Hervé said: where I could have a sample of a ServiceModule code that is working fine for an unigui application, please ? You can check by simply creating an empty project. 1
Hervé Posted May 28, 2025 Author Posted May 28, 2025 Hello ! A big big thank you ! It works very well... I've forget this wizard, since I've started my project ...And I was looking for something that was under my nose ! 20/20 for the support! Have a nice evening, Big thank you! With best regards, Hervé. 1
Recommended Posts