You can use VI Server to programmatically enable and disable the LabVIEW Web Server using the Web Server.Server Active
To create this piece of code, follow these steps:
- Open an Application Reference (Functions Palette » Application Control » Open Application Reference) to the local version of LabVIEW. By leaving the machine name input of the Open Application Reference VI blank, LabVIEW defaults to the local machine.
- Wire a Property Node to the LabVIEW Application Reference output, and select the property Web Server.Server Active.
- Right-click on the property and select Change to Write. This property accepts a boolean input and determines whether the Web Server is turned on or off.
- Connect e.g. a boolean constant to that boolean input to switch the server on or off.
- Close the Application Reference using a Close Reference node.
As explained in the context help, this property can only be accessed from the local copy of LabVIEW. Any attempt to access this property from a remote application will result in a permission error. In addition, any active connections to the web server that are open when this VI is called will not be automatically closed.
All Web Services served by the Web Server will be in active while Web Server is inactive.