From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot start web server on executable

Solved!
Go to solution

Hi

 

We have an interesting problem with a webserver - we cannot get it to initialise using property nodes or the ini file on a compiled executable.

 

As part of our application we start the webserver to publish a status page to be viewed remotely. This works fine when we are running in the development environment and also when we are running an executable on a PC with the development environment installed, however it will not initialise on a PC with just the runtime engine installed.

 

I've attached a portion of code which functionally does exactly the same as in our main application. I've been using this as my tester code and built it into an exe while trying many different things to fix it.

When executed:

  • The code will sit in the while loop until I press stop.
  • Web server: Server Active = FALSE
  • error out = NO ERROR

 

Webserver enable.png

 

In the full application the while loop waits for a couple of seconds before throwing an error if the server has not started. In this example I can leave the loop running for some time without it starting. Normally startup time is <50ms when succesful.

 

This is the ini file for the executable:

[WebTest]
server.app.propertiesEnabled=True
server.ole.enabled=True
server.tcp.serviceName="My Computer/VI Server"
server.vi.propertiesEnabled=True
WebServer.Enabled=True
WebServer.TcpAccess="+*"
WebServer.ViAccess="+*"
DebugServerEnabled=False
DebugServerWaitOnLaunch=False

 

And this is the webserver config file:

ErrorLog "$LVSERVER_ROOT/logs/error.log"
LogLevel 3
ServerName default
DocumentRoot "$LVSERVER_ROOT/../../www"
Listen 8000
ThreadLimit 10
TypesConfig "$LVSERVER_ROOT/mime.types"
DirectoryIndex index.html
LoadModulePath "$LVSERVER_ROOT/modules" "$LVSERVER_ROOT/LVModules" "$LVSERVER_ROOT/.."
LoadModule LVAuth lvauthmodule
LoadModule LVSnapshot lvsnapshotmodule
LoadModule LVRFP lvrfpmodule
LoadModule dir libdirModule
LoadModule copy libcopyModule

AddHandler LVAuthHandler
AddHandler LVSnapshotHandler .snap
AddHandler LVRFPHandler

AddHandler dirHandler
AddHandler copyHandler

CustomLog "$LVSERVER_ROOT/logs/access.log" "%h %l %u %t \"%r\" %>s %b"
KeepAlive on
KeepAliveTimeout 60
Timeout 60


As a side note, can anybody tell me where the $LVSERVER_ROOT variable is configured?

 

 

Things I have tried:

  • Copying a new config file from the default location before initialisation
  • Writing a pre-defined (hard-coded) config file before initialisation
  • Setting root directory locaitons before initialisation (this one actually throws an error because the server isn't active...)
  • Setting WebServer.Active = TRUE repeatedly inside the while loop
  • Enabled/disabled the web server in the ini file

System:

  • Labview 2010
  • PC's with running Windows 7

 

Thanks for any help because this is driving me slowly mad!

Ben

0 Kudos
Message 1 of 4
(3,935 Views)

Hi!

did you already check here

http://digital.ni.com/public.nsf/allkb/6F58D8300ACB743C862579F8006E2800?OpenDocument ?

I'll try investigating as soon as I have more time,

Marco

 

0 Kudos
Message 2 of 4
(3,928 Views)
Solution
Accepted by topic author BenCW

Hi Marco, thanks for replying.

 

I had looked at that guide previously and had done everything in it but one small section did give me a hint of something to try and I have solved my problem, so thanks!

 

Here is the issue if anyone is interested:

 

The DocumentRoot folder in the config has to exist otherwise the webserver cannot be started. So basically, make sure that the file points to a folder that exists!

 

This does leave two slight annoying issues though - you can't see if the folder exists (and then create it) before starting the webserver because you can't query the folder path without the webserver running.

AND

You can't really set the config file programatically because the settings from the file are loaded on execution, not on webserver start.

 

The result of this is that the config file and the document root folder should be created (and matching of course...) when the executable is built / installed on the system. Not a massive headache but it means remembering to put things into the build spec and not rely on the software to do the work on boot

0 Kudos
Message 3 of 4
(3,915 Views)

Hi, I have a problem quite similar but I an not able to solve it following the solution of this thread. 

Now I'm using Labview 2018 and I have some web services deployed on the web server.

After some days of continuous work (some services are called continuously; i.e at 1 Hz rate by clients on the network), it happened that I've found the web server not responding any more.

So I would like to monitor the web server status and to try to restart it if it has been found down.

I have created a VI that checks and logs the web server status (see annex).

This VI works fine when executed in LabVIEW; but doesn't work - without errors - when executed in an executable file.

When I did the build, I included the web service inside the build tab.

After the build, the folder contains the .lvws file, the niwebserver.ini and niembeddedws.ini files, the exe file and the application.ini file.

I've also tried to modify the .conf file created after build inside both the niwebserver.ini and niembeddedws.ini (the documentroot folder as stated in the previous post, the first time with the current exe folder that contains lvws file and the second with the C:\Program Files (x86)\National Instruments\Shared\NI WebServer folder ) without success.

 

Can someone help me to solve?

 

 

0 Kudos
Message 4 of 4
(2,922 Views)