LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Start Web Server in stand-alone

I'm trying to get the Web Server to start-up whenever I start up my compiled stand-alone application.
 
I've looked through the help file, but the information there isn't very clear.  Does anyone have a better explanation of how to get the Web Server to startup whenever my stand-alone application starts?
Message 1 of 8
(4,471 Views)
Hi Steve,

One of these two knowledgebase articles should answer your question, but let me know if they do not:

Automatically Enable Web Server for Applications
Can I Automatically Run the Web Server on LabVIEW Startup or When I Run a VI?
Message 2 of 8
(4,438 Views)

I've successfully manged to bulid a stand alone vi that starts the web server every time it is started. Now I want to run it on a non standard port (not 80), for network policy reasons. I change the port in options/Web server configuration/ HTTP port to 10080. If I run it in development system it works ok, but when I build it as a stand alone vi and start it I cannot access it from a web browser.

 

Ola

0 Kudos
Message 3 of 8
(4,321 Views)

Ola_A, What version of LabVIEW are you using?

 

Check the web server configuration to make sure the correct port is being used.

Before 8.6 this would be the WebServer.Port token in Application.ini

In 8.6 and later this is found in the niwebserver.conf file next to Application.ini.

 

If the port is correct then make sure that the web server is turned on with the WebServer.Enabled tag in Application.ini. Also make sure the dev environment doesn't have the server listening on the same port when you run your Application, otherwise the Application's web server will not be able to listen on that port.

 

Let us know how it goes.

 

Nathan

0 Kudos
Message 4 of 8
(4,313 Views)

Ola,

 

First the obvious question...are you putting the non-standard port number into the address bar of the browser trying to access the VI?  If the 'standard' port 80 page was at http://localhost/WebPage.html, the new address would be http://localhost:10080/WebPage.html.

 

What I've got to work is to edit the application.ini file that's in the folder that holds your compiled VI.  Open it up and look for the line that starts with "WebServer.Port=".   Make sure that the port you want to use follows the = sign.  This works for me.  I've even got an external program that'll go in and find that line and change it to whatever port I want to use.  Then, when the VI starts, I can get to it using the address : port as in the first paragraph.

 

Good Luck.

Steve

Message Edited by Steve257 on 03-10-2009 08:45 AM
0 Kudos
Message 5 of 8
(4,304 Views)

The port is set to 10080. As far as I can see the port is also correct in the niwebserver.conf file. In application.ini the WebServer.enabled is true. See below for both files!

Ola

 

 << niwebserver.conf>>

# Web server configuration file.
# Generated by LabVIEW 8.6
# 2009-03-09 10.48.22

#
# Global Directives
#
ServerRoot "."
ErrorLog "./logs/error.log"
LogLevel 3
CustomLog "/:/:/:/:/:/Program/National Instruments/LabVIEW 8.6/resource/webserver/logs/access.log" "%h %l %u %t \"%r\" %>s %b"
TypesConfig mime.types
ThreadLimit 10
LoadModulePath "./modules" "./LVModules" "./.."
LoadModule LVAuth lvauthmodule
LoadModule LVSnapshot lvsnapshotmodule
LoadModule LVRFP lvrfpmodule
LoadModule dir libdirModule
LoadModule copy libcopyModule
LoadModule esp libespModule
Listen 10080

#
# Directives that apply to the default server
#
ServerName default
DocumentRoot "./../../www"
Timeout 60
AddHandler LVAuthHandler
AddHandler LVSnapshotHandler .snap
AddHandler LVRFPHandler
AddHandler dirHandler
AddHandler espHandler .esp
AddHandler copyHandler
DirectoryIndex index.html
KeepAlive on
KeepAliveTimeout 60
 

 

 << application.ini >>

[Recept_22]
server.app.propertiesEnabled=True
server.tcp.servic="My Computer/VI Server"
server.vi.propertiesEnabled=True
WebServer.Enabled=True
WebServer.TcpAccess="c+*"
WebServer.ViAccess="+*"
DebugServerEnabled=False
DebugServerWaitOnLaunch=False
 

0 Kudos
Message 6 of 8
(4,298 Views)

Steve, I can connect with localhost:10080 when the vi is run in development system, so most parts are tested. I use LV 8.6. I actually restarted the computer and only run the compiled vi to make sure the development systems web server didn't interfere.

 

Ola

0 Kudos
Message 7 of 8
(4,296 Views)

In the niwebserver.conf file you should take a look at a couple of your paths.

 

The CustomLog path is obviously wrong.

The ErrorLog may be ok but is going to try and save to a directory that might not be convenient for you.

 

You can delete those lines if you don't want the log files. Otherwise change those to valid paths to the log files you want to use. ie. "C:\logs\error.log" for example.

 

The DocumentRoot path is probably wrong. It is going to be relative to the LabVIEW run time engine installed directory. This is almost certainly not what you want.

You can't delete this directive or else the server cannot start. Change this to a valid absolute path to the directory where your web pages live.

 

You can find some more information about using the web server and web services in the following link. Number 13 has some information about built executables.

http://zone.ni.com/devzone/cda/tut/p/id/7747

 

Nathan

0 Kudos
Message 8 of 8
(4,290 Views)