thomh 0 Posted Monday at 01:43 PM Hi, we have a bunch of customers running our Delphi coded RealThinClient server as a service in a domain controlled server environment. They have set Windows Update to check for updates but not to automatically install them. When the server does a Windows update check it happens often that our Delphi services stop responding. If we stop the services we cannot start them again until we restart the server. Something happens in a domain controlled server environment when this Windows update check is done that messes up the services. Our .Net services are not affected and keeps on running. Has anybody seen or heard of this problem and is there a solution? Thanks, Thom Share this post Link to post
David Heffernan 1220 Posted Monday at 01:49 PM What happens in a do nothing Delphi service? Do they stop too? If not then the problem is likely in your service code. Share this post Link to post
thomh 0 Posted Monday at 06:29 PM Hi David, Delphi service that does nothing stops also. It might have something to do with how I start the service. This is straight from the RTC demo app. Is there a more "modern" way of starting the service? function ServiceStart(const aMachine, aService: String) : Boolean; var schm, schs: SC_Handle; ss: TServiceStatus; psTemp: PChar; dwChkP: DWord; begin ss.dwCurrentState := 1; schm := OpenSCManager(PChar(aMachine), nil, SC_MANAGER_CONNECT); if (schm > 0) then begin schs := OpenService(schm, PChar(aService), SERVICE_START or SERVICE_QUERY_STATUS); if (schs > 0) then begin psTemp := nil; if (StartService(schs, 0, psTemp)) then begin if (QueryServiceStatus(schs, ss)) then begin while (SERVICE_RUNNING <> ss.dwCurrentState) do begin dwChkP := ss.dwCheckPoint; Sleep(ss.dwWaitHint); if (not QueryServiceStatus(schs, ss)) then Break; if (ss.dwCheckPoint < dwChkP) then Break; end; end; end; CloseServiceHandle(schs); end; CloseServiceHandle(schm); end; Result := SERVICE_RUNNING = ss.dwCurrentState; end; Share this post Link to post
Cristian Peța 56 Posted Monday at 08:13 PM (edited) I think a standard Delphi service would be using TService. http://docwiki.embarcadero.com/RADStudio/Sydney/en/Service_Applications Just create a service project and put this in OnExecute event: procedure TService1.Service1Execute(Sender: TService); begin while not Terminated do ServiceThread.ProcessRequests(True); end; Edited Monday at 08:24 PM by Cristian Peța Share this post Link to post
Lars Fosdal 837 Posted Tuesday at 12:06 PM Our services runs on domain controlled servers and are descendents from TService, but they must be configured to run with a specific AD user (i.e. not the default system user) that has the necessary rights to access it's own file, and to start and stop services to be able to upgrade themselves. Share this post Link to post
Dany Marmur 202 Posted Tuesday at 04:52 PM I would be rather surprised if this has anything to do with RTC itself. However, building service code (or DI stuff) on demos can bite back. I do know that some of the RTC demos are compatible back to... well very long. So maybe you found a demo that was written with very long backwards compatibility in mind.. RTC do not make any presumptions on how you write your service DM. I'd suggest you delve deep into TService and all that. Also - this is a painful methodology, eps if the fault cannot be simulated in you dev environ - start to rip things out and see it it starts working. HTH Share this post Link to post