Startup VIs in LabVIEW Web Services Not Executing

Updated Sep 15, 2023

Reported In

Software

  • LabVIEW

Issue Details

  • I have created and published a Web Service in LabVIEW using a package. After installing it and running it on my host pc, my Startup VIs are called correctly. After I reboot my PC, the Startup VIs are never called again. How can I make sure my Startup VIs run?
  • I am trying to use Startup VIs in my published Web Service with an executable but none of my Startup VIs ever execute. Why does this happen?

Solution

Web Services on Windows Host PCs

Standalone Web Services that are running on a Host PC are intended to be published directly from LabVIEW, as described in Publishing a Web Service (Real-Time, Windows) . If the Web Service is installed using a Package build, the LabVIEW Run-Time Engine may not start up quickly enough after the pc reboots. This can prevent Startup VIs from running.

To avoid this issue, it is recommended to distribute the Web Service with a standalone application. The LabVIEW Application will use a unique Web Server to host the Web Service. Refer to Publishing a Web Service through a Stand-Alone Application (Real-Time, Windows)  for further information. If you want to launch the executable when Windows boots you can follow the steps in the following article: Running a LabVIEW Executable When Windows Boots

When using LabVIEW 2020 or 2021 a standalone Application does not correctly execute Startup VIs when using the NI Web Server unless a niembeddedws.config file is included in the Application build files. This file can only be generated when the Application is built to use the Application Web Server. This bug was reported with ID 1754642 and fixed in LabVIEW 2022 Q3, it is listed in the LabVIEW 2022 Q3 Bug Fixes. Please note that the fix works when using an executable to publish the web service but does not work correctly when using a package and rebooting the pc.

If you are using LabVIEW 2020 or 2021 and publishing the web services using a stand-alone application (EXE) you can follow these steps to work around this bug:
 
  1. From the LabVIEW Project tree, right-click Build Specifications >> New >> Application (EXE).
  2. In the Information tab of the Application Properties Window, specify a name and destination for the Application.
  3. In the Source Files tab, ensure that the executable VI is listed as a Startup VI and any Web Service VIs are listed under Always Included.
  4. In the Web Services tab, place a checkmark in the Web Service to include. Then, select Application Web Server.
  5. Click Build.
  6. When the build is complete, navigate to the Application directory and verify that a niembeddedws.conf file exists amongst the other Application build files.
  7. In the LabVIEW Project, right-click the newly built Application and select Properties.
  8. From the Web Services tab, select NI Web Server.
  9. Click Build.
  10. When the build is complete, launch the standalone application to start the Web Service.
  11. The Startup VIs will execute when the landing page URL is accessed.



Web Services on Real-Time Targets

For Web Services published on real-time targets, refer to the troubleshooting suggestions below.