Developing Startup VIs to Initialize and Communicate with HTTP Method VIs (Real-Time, Windows)
- Updated2025-01-22
- 3 minute(s) read
Developing Startup VIs to Initialize and Communicate with HTTP Method VIs (Real-Time, Windows)
Startup VIs run as part of a Web service application but do not exchange data with a web client. A startup VI runs once, when the Web service loads, and can continue to run as long as the Web service is published. Consider the following template block diagram for startup VIs:
|
||
![]() |
Initialization frame | Runs once to perform tasks such as loading data from a file to initialize a value. |
![]() |
Processing loop | Iterates until an error occurs or the
service stopping?
output of the
Get Web Service Status
VI returns TRUE because the Web service is stopping. Ensure the startup VI finishes executing soon after the Get Web Service Status VI indicates the Web service is stopping; otherwise, LabVIEW aborts the startup VI. Note The
LabVIEW Web Service
control allows VIs on the
Service
palette to access information about the current Web service, such as its status. This control functions similarly to a refnum in LabVIEW. |
![]() |
Clean-up frame | Runs once after the status of the Web service is stopping. You might use clean-up code to cancel tasks that have been running a long time to avoid hanging the server. |
Programming Guidelines
Modify the startup VI template to meet the needs of your application. For example, consider the following changes you might make:
- If you only need to perform an initialization action, you can delete the processing and clean-up code.
- Remove or adjust the Wait (ms) function in the processing loop according to the timing requirements of the VI. Or, if the startup VI waits on data from a queue, use a timeout instead of a wait.