I have a project which has a Web Resource set up, as shown in the image below:
Currently, if I want TemperatureService
to accept connections, I need to right click it and then choose Start. This is somewhat inconvenient, but more importantly, requires an additional step from the operator of these tools, which might lead to undesired human error due to forgetfulness, unawareness etc.
For this reason, I would like to have the ability to start TemperatureService
automatically when running a certain VI in this project. So far I have found several resources/tutorials 1, 2, 3, but all I could gather was how to auto-start the admin interface of the web service, which is done by adding the following blocks to the VI (mainly Open Application Reference):
... which didn't start the service. I also tried setting the Property Node
's property to Server:TCP Listener Active
, but this didn't have the desired effect either.
To summarize: how can I automatically start a specific web service when running a VI?
I am working with LabVIEW 2015 running on a 64-bit Win 7.
By following this tutorial on the NI site, I was able to successfully create a persistent web service that continued to run after exiting LabVIEW and after restarting the computer (or at least, the VM in which I run LabVIEW).
As described in the tutorial, if you start the web service by right-clicking it in the project and choosing Start, the service runs in a debugging server which terminates when you exit LabVIEW.
However when you choose Application Web Server > Publish, the service runs in LabVIEW's application web server and continues to run after exiting LabVIEW and after restarting the computer.
Note that the application web server runs on a different port from the debug server; after publishing the service, right-click on a method VI and choose Show Method URL... to see the correct address.
If deployment fails with the error Target OS for this Web service differs from the Web server configuration
, make sure that the server is configured for the same runtime (i.e. 32 or 64 bit) as the LabVIEW development environment.