I have been investigating this subject and I have a couple of questions…
1-I’ve read about installing the webapp as a service… is it a requisite or it is just recommended… ?
2-If it is in fact a requisite, then what’s the difference between using this tool http://nssm.cc/ and typing ‘sc create MyWebAppSvc type= own start= auto binpath= c:\Path\To\Exe\mywebapp.exe’ (as recommended in the Xojo docs) ?
3- In any case… what should be done in the event of a crash ? Would the service restart itself ?
NSSM works pretty nice. I created two BAT files. One to install the service and one to remove the service. NSSM has lots of options to set parameters for things like auto restart the service if it stops and other features.
When you need to install a new version run the BAT file to remove the service, copy the EXE and other “stuff” to the proper directory, then run the BAT file to reinstall the service.
SC probably would work too but I have not tried it.
I’ve been running Web apps as a service on my Windows 2012R2 server for a while now.
I create batch files to start, stop, delete and install services between updates. The second thing I do is to run the Services app. Right-click on your service then click properties. Under General, I make the Startup type Automatic. Under the Recovery tab, I select Restart Service at First, Second and Subsequent failures. I set days to 0 and restart service after 1 minute.
INSTALL_SERVICE.BAT
@echo Creating a new Service for ICBW-PRF
sc create icbw-prf binpath= "c:\\services\\icbw-prf-3001\\icbw.exe --port=3001" start= auto displayname= _ICBW-PRF:3001_COMBUTS
@echo
@echo Starting ICBW-PRF
sc start icbw-prf
@pause
My only concern is that my Apps tend to crash if two browsers connect to the web app and interact with it at the same time. I Don’t know yet why this happens.
The better way would probably be to use XAMPP or WAMP and install ActivePerl or StrawberryPERL and then launch instances of every app where sessions are kept separate. This way my Apps don’t crash but does tend to use more memory. In the case of ActivePERL every instance use about 7M just for PERL and also increments your apps memory footprint with every browser that connects.
ps. Personally, I would prefer if I can figure out why the web app sessions crash when using services because the memory footprint is a lot less than going the PERL/XAMPP route.