You are not logged in.
Using Delphi XE8 and the latest nightly build of mORMot, I have created a 'stand-alone' ReST Server (as shown below) that runs on a Windows Server hosted by Amazon.
iConnection := TSQLDBZEOSConnectionProperties.Create(TSQLDBZEOSConnectionProperties.URI(dMySQL, c_mySQLDBServer + ':3306'), c_mySQLDB, c_mySQLDBUsername, c_mySQlDBPassword);
try
iModel := OurDataModel;
VirtualTableExternalRegister(iModel, TCustomersProducts, iConnection, 'TableCustomersProducts');
try
iRestServer := TSQLRestServerDB.Create(iModel, ':memory:', false);
try
iRestServer.CreateMissingTables;
iHttpServer := TSQLHttpServer.Create(SERVER_PORT, [iRestServer], '+', useHttpApiRegisteringURI);
try
writeln('Background server is running.'#10);
write('Press [Enter] to close the server.');
readln;
finally
iHttpServer.Free;
end;
finally
iRestServer.Free;
end;
finally
iModel.Free;
end;
finally
iConnection.Free;
end;
Everything works as expected during the day. Indeed, my server is running in the background and my Client is able to access it without any problems. However, if the server has been 'running' all night long, the next morning, my Client app is no longer able to access it. At that point, I have to stop and re-start the server.
I suppose that, because the server was not called during the night, the connection to the database was lost.
What should I do in order to keep my server running functionally for long period of time? Any suggestions, pointers would be greatly appreciated.
Offline