LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Webservice to EXE?

Hi Community,

 

I am running a homepage on our intranet from a Windows server 2008. The server restarts from time to time (I guess installs updates), but because I run my webservice directly from the Labview project, the homepage remains down until somebody recognizes that its down and drops me a mail.

 

I'd like to get rid of this problem and want to make sure the service restarts when the server reboots. I guess the right way is to compile the project into an exe and the somehow start the exe when the server reboots. 

 

I am having issues though with the exe. The compilation happens without an issue but when I run the exe, my startup VI shows up but stops with the following error message: 

 

NI_WebServices.lvlib:Error Converter (ErrCode or Status).vi<APPEND> <b>Complete call chain:</b> NI_WebServices.lvlib:Error Converter (ErrCode or Status).vi NI_WebServices.lvlib:Web Service.lvclass:Get Web Service Status.vi REMS_STARTUP.vi

 

In the build specs I have added my startup VI to the startup section, everything else to the "always included". I have checked the checkbox of the webservice I want to create on the webservices menu. I have tried to follow the steps in this document but the result is the same.

 

Any guess?

thanks!

0 Kudos
Message 1 of 11
(7,452 Views)

Is it a LabVIEW application AND a web service or are you just using a web service?

 

If you have a LabVIEW application - yes, you're right that you should probably compile it into an executable - you can then put it in the startup folder on the server and it will run when the user logs on (which you can configure to happen automatically). It's also possible to configure an executable to run as a service so it will run before logon (but with some caveats like no user interface). It may also be possible using scheduled tasks to run at boot rather than have to wait until a user logs on.

 

If you just have a web service you can 'publish' it and then it will be installed onto the NI Application Web Server and will run as a service - I think it will be accessible all the time while the computer is running.

 

From what you've described, it sounds like you're trying to build an executable from your web service with the web service startup VI as the startup VI for the executable (which doesn't quite make sense with how web services work...they run in their own application instance on the NI Application Web Server - think of it like deploying VIs to a real-time target like a cRIO but to the NI Web Server). If that's correct - you don't need to build an executable at all - you just need to publish your web service.

 

The error that you're getting is probably because you're using web service VIs in an executable - they probably only run in the context of the NI Web Server.

 

Of course, checking things like the configuration of the web server (that it's running, which port it's on etc.) can't hurt either.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 11
(7,384 Views)

Alright, it seems that despite the page I have created I have an issue understanding what is the web service and what it the web server.

 

In my mind:

Webserver: a windows process serving the html requests. Similar to eg. Apache, but a labview version. I guess publishing the webserver has nothing to do with the services. 

Webservice: the code I wrote and run in my labview project by starting my service

 

Let me rephrase what I want to achive so you may have a better idea about what would i like to achive: currently I need to open the project file, right click on my webservice name (which under you can find your pages, GET and POST functions etc) and select start. I assume this action must start the webserver as well. I need to automate this so if the server reboots my service restarts. (and its key to have the startup VI running as it does a lot for me).

 

I am completely unsure if I need to build an EXE although that looks quite a natural move, I just cant do it. But there could be another way to achive my goal.

 

Another thing to note is that my app has nothing to do with RT or cRIO, its simply a PC application. It could have been written in HTML + PHP etc, but as I know very less about them and I know labview pretty well it was a lot easier to write it in labview. (of course I use a lot of html code, but how to process certain things from the databases, how to send emails etc etc, are done from labview)

0 Kudos
Message 3 of 11
(7,365 Views)

Ok, so here are a few terms to clarify things...

 

NI Application Web Server: This is a Windows Service which runs on your computer and serves your published web services (through http).

Web Service: Your LabVIEW Web Service VIs (i.e. your web service application) which run on the web server

'Start' Web Service: This deploys your web service in 'debug' mode in your local application instance (i.e. development mode). This will run on a different port to the NI Application Web Server.

'Publish' Web Service: This publishes/installs your web service to the NI Application Web Server so that it will run as a windows service (i.e. always available). You will need to re-publish the web service after you have made changes.

 

If you open the Web Based Configuration Utility (from MAX) - there is a web server configuration page and a web services page which will show you which port your NI Application Web Server is running on and also your published web services.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 4 of 11
(7,349 Views)

Ok... are you saying that once I publish my webservice labview magically bundels my application into one windows process? Cause if this is the case then this will be the solution for me.

 

You are right, currently I run my app in the debug mode, although as I was not aware of what the heck is the difference between the "debug" and the "application" mode I was not really bothered. Moreover I have changed my debug server port to 80 so users can access the webpage without typing :8001 to the end of the URL.

 

I have tried to publish my webservice. Labview dropped me no error and if type url:8080 it doesnt give me an error message. I dont see my index.html coming up though. I have opened port 8080 on the server and I have rebooted the computer.

 

So all in all I think the publish was successful but I can't see my home page. Do you have an idea what went wrong?

 

thanks

0 Kudos
Message 5 of 11
(7,333 Views)

Yes - that's exactly what happens when you publish the web service.

 

If you are getting a blank page, have you remembered that your web service is name spaced? The URL should be http://server:port/webservicename/

 

Have you also checked that the NI Application Web Server is running from Windows Services and also checked it's configuration from the Web Configuration Utility - can you post a screenshot of the settings?

 

Also, in the first instance I would try accessing it locally from the server running the web server using http://localhost:port/webservicename/ just to rule out any firewall/connection issues.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 6 of 11
(7,327 Views)
Ok... I cant do too much right now as this is a peak time for my users to use the service although I have recognized this: While the main page is not accessible some the pages of my service are. As I said I did lots of things from labview which a person normally wont do if he codes in html. For example I open certain files from labview, generate an html content based on the contents of the files and then dump these into an html file. Is it possible that this type of an action is not something the published webservice can handle? I also launch some exe files at the beginning of my startup VI, which I dont see starting when I publish my service but they start just fine if I run the service from the labview project in debug mode. Did I make something really wrong?
0 Kudos
Message 7 of 11
(7,306 Views)

Hello,

 

Maybe you can help me.

 

I'm trying to build an application (.exe) from the web services tutorial http://zone.ni.com/reference/en-XX/help/371361K-01/lvhowto/build_web_service/ in LabVIEW 2013. The web service works well in debug mode (localhost:8001 default port) and also when published in the NI Application Server (localhost:8080 default port). However, when I build the application, execute the .exe file, and try to call the web service embedded in the application (localhost:8002 default port) the browser gets the following error: The computer or device (127.0.0.1) is not configured to accept connections on port "8002".

 

It seems the applciation doesn't load the web service when it's executed. Why?

 

PD: I've attached the project

0 Kudos
Message 8 of 11
(7,124 Views)

Ok, one important thing I just noticed.

 

My previous post was related to a LabView installation in a 64 bits Windows 8.1 system. However, I opened the same project in a 32 bits system, I built the application, the .exe works perfectly deploying the web service nicely, and I'm now able to call the web service through localhost:8002.

0 Kudos
Message 9 of 11
(7,099 Views)

Hi,

 

I would check this document and see if you have the web service configured correctly and you are building your application correctly for a web service-

 

http://zone.ni.com/reference/en-XX/help/371361K-01/lvconcepts/ws_apps_installers/

 

Also, since this is an older thread, I would recommend posting your question in a new thread so that more community members see it and can respond to it.

 

-Eric

Eric H.
Senior Field Applications Engineer
NI
0 Kudos
Message 10 of 11
(7,081 Views)