LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with SystemLink/Skyline Tags in an NXG Web VI

Solved!
Go to solution

I have an application where I need to pass data from LabVIEW to NXG.  To try this out, I am using the Multiple Tag Writer example project in LabVIEW, which runs a VI called Write Multiple Tags Client.  No issues running this VI in LabVIEW 2018.

 

In NXG 3.1, I have created a gvi that can read the tag.  (pictured in the attachment).  This works just fine.

 

I would like to make this a web VI.  I tried copying/recreating the code into a gviweb, but when I run it, I get an error:

"Javascript message: Failed to load http://localhost/nitag/v2/tags: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:52818' is therefore not allowed access.  The response had HTTP status code 402. in index.html at line 0"

 

Is there a reason why this kind of VI works as a gvi, but not gviweb?

 

Thanks.

 

0 Kudos
Message 1 of 6
(3,200 Views)
Solution
Accepted by pulidotech

Since the WebVI is a web application running in a browser hosted by NXG, you probably need to enable CORS from the NI Web Server Configuration utility.  

 

Screen Shot 2019-06-24 at 2.19.56 PM.png

Message 2 of 6
(3,181 Views)

That worked.  I'm glad the solution was simple.

0 Kudos
Message 3 of 6
(3,175 Views)

Follow up question. 

 

I built the web application following this page:

http://www.ni.com/documentation/en/labview-web-module/latest/manual/building-a-web-application/

Then, I hosted it on the NI web server

http://www.ni.com/documentation/en/labview-web-module/latest/manual/hosting-ni-web-server/

 

I can see/run the application when I'm in a browser on the same computer.  I tried to access the web application on my phone (connected to the same network).  I can see the web VI, but I get error 363650.  It looks like it's related to CORS, but CORS is enabled for all, just like in your instructions.  

0 Kudos
Message 4 of 6
(3,144 Views)

Hi, ,me too. I get the same error related to CORS. Is this problem is still occur? Did you somehow manage to overcome it?

0 Kudos
Message 5 of 6
(3,024 Views)
0 Kudos
Message 6 of 6
(3,003 Views)