From 11:00 PM CDT Friday, Nov 8 - 2:30 PM CDT Saturday, Nov 9, 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: 

HTTP Server

Hi,

I am using HTTP Server (in Internet Toolkit) to publish a static html page which show the snapshot of a vi. I also set the restriction that people who connect to the html page must input correct username and password (by Internet Toolkit Configuration). Now I want to change the vi to an exe file. Does anyone know exe file support HTTP Server or not? How to add HTTP Server in exe file?

Thanks
0 Kudos
Message 1 of 7
(3,649 Views)
Alan,

I guess you know this would be tremendously easy if you didn't have the access restriction requirement; you could just use LabVIEW's built-in, non-Internet Web Server, and add one line to your app's INI file.

But building the toolkit's Web server into an EXE should work, although it could be a struggle to get all the configuration details in place in the right relative positions with respect to the EXE so that everything works properly.

I would advise following the general outline given in the Building HTTP Server Into Your LabVIEW Application document in the zipfile on NI's ITK FAQ page topic for this issue. That document says some things that are more relevant to older App Builder versions, but the main thing is to add the zipfile's HTTP Dynamic VIs.vi as a dynamic VI when setting up the build, which ensures that all the files the G Web Server needs will be available in the EXE. And you need to make sure your VI programmatically starts the server, as described.

The How To Build the G Web Server Using CGI Into an Executable KB entry goes into more detail about CGI functionality, which probably isn't relevant in your case, and also gives some tips for the general configuration settings for the EXE. You basically have to recreate the G Server configuration files underneath the EXE. If you transplant your access restriction files and HTML files with embedded panels from the LabVIEW side of things, you should be able to get it to work.

Regards,
John
0 Kudos
Message 2 of 7
(3,631 Views)
Hi John,

When I try to add HTTP Dynamic VIS.vi as a dynamic VI, an error occur as show in the follow:
Error 7 occurred at Invoke Node in Dist read linkages.vi->Dist Cmp Settings to Disk Hier.vi->Build Application.vi
Possible reason(s):
LabVIEW: File not found. The file might have been moved or deleted, or the file path might be incorrectly formatted for the operating system. For example, use \ as path separators on Windows, : on Mac OS, and / on UNIX.


If I ignore this error and try to build exe file, another error occur:
Error 7 occurred at Invoke Node in Dist read linkages.vi->Dist Cmp Settings to Disk Hier.vi->Dist Build App Image.vi->Build Application.vi
Possible reason(s):
LabVIEW: File not found. The file might have been moved or deleted, or the file path might be incorrectly formatted for the operating system. For example, use \ as path separators on Windows, : on Mac OS, and / on UNIX.


How can I solve this problem?
Also, how can I add the restriction criteria (ask for user name and password when connect) into the exe file?

thanks

Regards,
Alan
0 Kudos
Message 3 of 7
(3,624 Views)
Hi Alan,

It looks like some of your VIs are not compiled to the version of LabVIEW you are using. You will have to mass compile the files that you need for the application. Please follow the instructions in this KnowledgeBase:

Error 7 at Invoke Node When Building a LabVIEW Executable

Let us know if that doesn't fix the issue.
- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
0 Kudos
Message 4 of 7
(3,613 Views)
Hi,

I can fix the error now. But I still don't know how to add the HTTP Server in my exe file. I already add the HTTP Dynamic VIs.vi as a dynamic VI and add "WebServer.Enabled=True" in INI file. What other things should I need to do?
When I run my exe file, the HTTP Server doesn't come out. Do I need to add any program to open the HTTP Server? Where should I place the html file and how to set the DocumentRoot?
Moreover, I want to control who can access the server, how and what file should I add when I building exe file?

Thanks

Regards,
Alan
0 Kudos
Message 5 of 7
(3,606 Views)
First: I forgot to warn you that you need to skip the first section of Building HTTP Server Into Your LabVIEW Application.doc, because that is actually describing how to use the built-in LabVIEW Web Server, not the Internet Toolkit server. The pre-5.1 instructions are the ones that are relevant for you.

> I already add the HTTP Dynamic VIs.vi as a dynamic VI and add
> "WebServer.Enabled=True" in INI file.

You should actually leave out this INI setting in your case. It enables the non-toolkit LabVIEW Web Server, whereas you need the toolkit version of the server, and enabling both on the same port would actually prevent the toolkit server from starting.

> When I run my exe file, the HTTP Server doesn't come out. Do I
> need to add any program to open the HTTP Server?

Yes--the Word document explains that you need to use the HTTP Server Control subVI (from the top-level ITK palette) on your main VI's diagram to kick the server off and then shut it down when the VI is done. Unless you do this, the server VI will never actually start.

> Where should I place the html file and how to set the DocumentRoot?
> Moreover, I want to control who can access the server, how and
> what file should I add when I building exe file?

The EXE will look for the same set of configuration files that the LabVIEW-environment server uses. I suggest that you take your entire <labview>\internet folder tree and copy it to the same directory as your executable. (I'm actually not even sure how to override the default settings so that the EXE looks elsewhere.) After you do this, you can dig into internet >> http >> conf and edit the configuration files for the EXE-embedded server. The port is set in lvhttp.cfg, and the server root is defined in srm.cfg .

As for access control, it works exactly the same way as in LabVIEW. You can create an htaccess.txt file in any directory that you want to password-protect. I haven't really used this feature, but you clearly have it working on the development system, so you should be able to duplicate the configuration for the EXE.

Horribly complicated, yes.

--John

Message Edited by Johnner on 03-11-2005 09:49 AM

Message Edited by Johnner on 03-11-2005 09:50 AM

Message 6 of 7
(3,600 Views)
Thanks for your help
0 Kudos
Message 7 of 7
(3,578 Views)