LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problem with web service included in a stand-alone application

I'm trying to run a labview stand-alone application which includes a web service VI using labview 2013 on a windows 7 64bit system.

 

According to the instructions I read, the web services included in a stand-alone app should be accessible through a web server unique to the application I built only while the app is running. However, when I run the application and try to access the web service with a web browser through the port I specified in the build specifications settings, I get the response "the connection to localhost:8002 could not be established". What am I missing?

 

These are the build settings I set up:

 

properties -> web services -> checked the web service I want to inlcude in the application & enabled HTTP port 8002.

properties -> source files -> added the web service VI to "always included" just in case.

 

Here is the niembeddedws.conf file I got:

 

# Web server configuration file.
# Generated by LabVIEW 13.0f2
# 4/19/2014 10:05:16 AM

#
# Global Directives
#
NI.AddLVRouteVars
TypesConfig "$LVSERVER_ROOT/mime.types"
LimitWorkers 10
LimitRequestBody 50000000
LoadModulePath $LVSERVER_ROOT/modules;$LVSERVER_ROOT/..
LoadModule niSessionManagerModule mod_nisessmgr
LoadModule niAuthModule mod_niauth
LoadModule EspModule mod_niesp
LoadModule WSRuntime ws_runtime
Listen 8002

#
# Directives that apply to the default server
#
NI.ServerName "LV Embedded Web Server"
DocumentRoot "$LVSERVER_ROOT/ws_www"
InactivityTimeout 60
SetConnector netConnector
AddHandler niAuthHandler
AddHandler WSRuntime
AddHandler fileHandler ""
AddOutputFilter chunkFilter
LimitRequestForm 50000000
NI.WSRuntime.Configuration embedded "$LVSERVER_ROOT/services"
NI.WSRuntime.LoadWebService Digital_Output_Web_Service.lvws

 

and here is the application.ini file I got:

 

 

[Application]
server.app.propertiesEnabled=True
server.tcp.paranoid=True
server.tcp.serviceName="My Computer/VI Server"
server.vi.callsEnabled=True
server.vi.propertiesEnabled=True
WebServer.TcpAccess="c+*"
WebServer.ViAccess="+*"
DebugServerEnabled=False
DebugServerWaitOnLaunch=False
RTTarget.ApplicationPath=\\vmware-host\Shared Folders\Documents\LabVIEW Data\Remote Development\startup.rtexe
RTTarget.VIPath=\\vmware-host\Shared Folders\Documents\LabVIEW Data\Remote Development

 

Of course, I also got the application.exe, application.aliases and webservice.lvws files too.

 

When I run the application and check the active ports with netstat -aon | more I don't see port 8002 listening either.

 

By the way, I tried first to access the web service as a stand-alone web service by deploying it directly from labview and it works fine. I'm testing everything in the same computer where I have the labview 2013 installed.

 

Any ideas?

0 Kudos
Message 1 of 8
(6,054 Views)

Hi ArturoSH,

 

A few questions for you:

 

- Are you copying the application to another location on disk before you run it? If so, are you also copying all the support files (conf, lvws, etc.) alongside it?

- Is the generated LVWS bundle really named "webservice.lvws"? According to the niembeddedws.conf file, it should be called "Digital_Output_Web_Service.lvws".

- What browser are you using to access the service?

- Are you running the 32-bit version of LabVIEW or the 64-bit version?

- If you run your LabVIEW executable from a command prompt, are there any errors printed to the screen?

 

An additional troubleshooting step is to enable the server's error log. At the top of your niembeddedws.conf, before the NI.AddLVRouteVars line, add the line

ErrorLog errors.log, level=2

This will generate a log file next to the application the next time you run it. It might give some more clues as to why things are not working.

 

Jacob C.

LabVIEW R&D

0 Kudos
Message 2 of 8
(5,947 Views)

Hi Jacob,

 

I met a similar problem that the web services can't be started/published from a stand-alone application. I'm using LabVIEW 2014 with the latest patches. I can publish the sevice from the LabVIEW IDE successfully.

 

With your troubleshooting suggestion, I got the following from the error.log. It said "Cannot open a socket on *:8002". Any suggestions?

 

Thanks.

 

appweb: 2: Configuration for Embedthis Appweb
appweb: 2: ---------------------------------------------
appweb: 2: Version:            4.1.0-0
appweb: 2: BuildType:          Release
appweb: 2: CPU:                x86
appweb: 2: OS:                 windows
appweb: 2: Host:               SHA1302010248B
appweb: 2: Directory:          D:\Program Files\National Instruments\Shared\LabVIEW Run-Time\2014
appweb: 2: Configure:          bit configure --platform windows-x86
appweb: 2: ---------------------------------------------
appweb: 2: Loading native module mod_nisessmgr.dll
appweb: 2: Loading native module D:\Program Files\National Instruments\Shared\LabVIEW Run-Time\2014\webserver\modules\mod_niauth.dll
appweb: 2: Loading native module D:\Program Files\National Instruments\Shared\LabVIEW Run-Time\2014\mod_niesp.dll
appweb: 2: Loading native module D:\Program Files\National Instruments\Shared\LabVIEW Run-Time\2014\mod_niws.dll
appweb: Error: Cannot open a socket on *:8002
appweb: 1: Couldn't start LVAppwebInterface

0 Kudos
Message 3 of 8
(5,729 Views)

Hi crxx,

 

The most common cause for that message is that the port is already in use by another server. Do you have any other applications running that could also be using that port (another web service application? the LabVIEW IDE itself?)

 

If you have a recent version of Windows, you can start the Resource Monitor from the Start Menu search bar, then go to the Network tab and open the Listening Ports section. It will give you a list of the currently in-use ports and what applications are using them (and you can sort by number to make searching easier). If you have administrative rights on your machine, you can also run netstat -a -b from a command line to determine what ports are in use, but you'll have to search the list yourself for an 8002 entry.

 

Jacob C.

LabVIEW R&D

Message 4 of 8
(5,663 Views)

@ArturoSH: How was the issue solved?

 

I have the same problem. I followed the http://zone.ni.com/reference/en-XX/help/371361K-01/lvhowto/build_web_service/ and it runs fine while start/stzop it from the labview project.

When I try to start it as standalone application it fails. Also the Error file shows no problems.

 

Just one noticeable issue:

 

When I start it from Labview and check with netstat -aon, the service listens as expected: TCP 127.0.0.1:8001

When I start the standalone application the service is started as TCP 0.0.0.0:8002

 

Do I have to add localhost somewhere?

 

Additionally, the standalone Application does not close when i close the running dummy Run.vi.

 

Thanks

 

 

0 Kudos
Message 5 of 8
(5,572 Views)

Seems to be a 64bit issue, 32bit works like a charm.

0 Kudos
Message 6 of 8
(5,534 Views)

>> Seems to be a 64bit issue, 32bit works like a charm.

 

I don't know, why it worked once, but meanwhile it seems not to be the reason.

 

I'm facing now the following issue in Standalone Mode (exe):

 

When I create a new startup VI, leave the content as default and run it, it ends immediately due to a 67001. However, the public folder is still served after the startup VI finished due to the 67001 error and the Web Ressources still work as well, as the other VI's still run in background. When I reshape the default startup VI and implement a loop condition that does not stop immediately, the Webservice does not start up and no public html and web ressources work, while the startup VI is looping. I also have to close the Startup VI by File--> Close all, otherwise the process remains alive in Task Manager.

 

In Labview Mode (no standalone exe) this is not the case. The WebService does also work, if there is a loop in the startup.vi that does no stop immediately.

 

 

 

0 Kudos
Message 7 of 8
(5,435 Views)

I'm refreshing this post as I have identical problem on my side.

 

I have tried to follow several links but without success up to now.

 

I created the log.text of my application.exe which should potentially launch my web application.

 

Here is :

appweb: 2: Configuration for Embedthis Appweb
appweb: 2: ---------------------------------------------
appweb: 2: Version:            4.1.0-0
appweb: 2: BuildType:          Release
appweb: 2: CPU:                x86
appweb: 2: OS:                 windows
appweb: 2: Host:               Mirsad-PC
appweb: 2: Directory:          C:\Users\Mirsad\Documents\SwissOpticsSys\Clients\ObsGE\Projet\HARPS-N\Software\HARPS-LCU\LabView\New Front Panel\Executable TEst\builds\NEW FRONT PANEL 2\My Application
appweb: 2: Configure:          bit configure --platform windows-x86
appweb: 2: ---------------------------------------------
appweb: 2: Loading native module C:\Program Files (x86)\National Instruments\Shared\LabVIEW Run-Time\2016\mod_nisessmgr.dll
appweb: 2: Loading native module C:\Program Files (x86)\National Instruments\Shared\LabVIEW Run-Time\2016\webserver\modules\mod_niauth.dll
appweb: 2: Loading native module C:\Program Files (x86)\National Instruments\Shared\LabVIEW Run-Time\2016\mod_niesp.dll
appweb: 2: Loading native module C:\Program Files (x86)\National Instruments\Shared\LabVIEW Run-Time\2016\webserver\modules\mod_nissl.dll
appweb: 2: Loading native module C:\Program Files (x86)\National Instruments\Shared\LabVIEW Run-Time\2016\webserver\modules\mod_ssl.dll
appweb: 2: Loading native module C:\Program Files (x86)\National Instruments\Shared\LabVIEW Run-Time\2016\mod_niws.dll
appweb: 2: Started HTTP  service on "*:8002"
appweb: 2: Started HTTPS service on "*:8080"
appweb: 2: Using configuration file "C:\Users\Mirsad\Documents\SwissOpticsSys\Clients\ObsGE\Projet\HARPS-N\Software\HARPS-LCU\LabView\New Front Panel\Executable TEst\builds\NEW FRONT PANEL 2\My Application\niwebserver.conf"
appweb: 2: Set server root to: "C:\Program Files (x86)\National Instruments\Shared\LabVIEW Run-Time\2016\webserver"
appweb: 2: Config File C:\Users\Mirsad\Documents\SwissOpticsSys\Clients\ObsGE\Projet\HARPS-N\Software\HARPS-LCU\LabView\New Front Panel\Executable TEst\builds\NEW FRONT PANEL 2\My Application\niwebserver.conf
appweb: Error: Unknown option null

 

 

Apparently an unknown option which I don't know to what it corresponds.

 

Any help on this ?

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