08-16-2013 02:30 PM
What would be the best way to run a LabVIEW executable as a service? I needed this recently and I think I have set up such a service using srvany.exe from the Windows 2003 Resource Kit, but that seems like a bit of a hack. The Kit is not offically supported in Server 2008, but seems to work. I don't know about Server 2012 or beyond.
So what would be the "proper" way of going about creating a Windows service from a headless LabVIEW application?
08-16-2013 03:01 PM
The proper way is to interface to the according Windows service control API. That is however not a trivial task to do. We used to sell a LabVIEW toolkit which supported a full interface to this, but it's not currently actively marketed.
srvany.exe is sort of a hack but works reasonably well for most use cases, as long as you do not need any further interaction with the service manager interface in Windows than to start and stop your service.
08-17-2013 09:23 AM
You could create a Web service, other services aren't available as standard.
/Y
08-19-2013 11:59 AM
ShaunR on Lava mentioned running an application using the task scheduler.
http://lavag.org/topic/17019-run-the-labview-program-windows-background/#entry104561
This is not a service but it runs an application without having to login which is usually the goal. I've never tested this but it sounds simple enough.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
01-13-2016 01:44 PM - edited 01-13-2016 01:45 PM
Hello,
In the past I tried srvany, but nssm (https://nssm.cc/) is much better and simple to use.
Keep in mind to discard the Event "Application Instance Close?", otherwise your Service will be stopped if the User logs off.
Also be shure that your Service will never open a Dialog, because a Service has no Frontpanel.
I can run this Application quite normal (=with Frontpanel) or as a service.
08-01-2016 07:09 AM - edited 08-01-2016 07:14 AM
Hello,
Now there is a "Featured pre Release" of nssm (https://nssm.cc/download).
Now is possible to call an exe before killing the Service. You can write an LabVIEW exe which end your Service gracefully. For expamle via VI-Server.It works!