Swi prolog as http server through windows service

is there an easy way to create a windows service? pointing to the swipl.exe? , let it run in/from a certain working-directory, and let it load the start .pl file from that directory, so that the swi-server will start automatically after system reboot on windows server.

this is needed because of the windows server updates after which the whole system will reboot

I have tried several things with for example:

sc create servicename binPath=“c:\swipl64\bin\swipl”

starting the service gives this error message , fout 1053 de service heeft de opdracht niet op juiste wijze beantwoord

I now see that I have posted it twice, i didnt see my first post because it was grayed out, sorry for that

I’m not an expert in this, but I think Windows expects a service to react to certain events and an executable that is not aware of this isn’t accepted. That seems to be confirmed if you search the web for “windows service wrapper”. For Unix the stuff required to be a service is in various libraries of the clib package and the HTTP support ships with library(http/http_unix_daemon) to deal with these issues.

Something similar should probably be written for Windows, though a generic wrapper process may do the job. As most modern Unix daemon managers require none or little special features from a service process, making most of the above obsolete …

dear Jan, thankyou for the answer and the information,

I have found this utility: http://nssm.cc/ and they say it can be used for creating this kind of service on windows,

the swipl.exe has to be informed of its working directory through the service also , so that it knows where to load the program-scripts.

I use swi-prolog for making programs on windows and on ubuntu, and it is really great to work with.

1 Like