John Lokanis Posted April 19, 2009 Report Share Posted April 19, 2009 I have spent some time trying to figure this out and here is what I can tell you that might be helpful. 1. Web Service VIs run in a separate application instance from the LV EXE that starts the web server. 2. Web Service VIs 'think' they are the application that started the web server. (have your web service VI return the App.Name property and you will see what I mean). 3. If you want to talk to your EXE (or any EXE) form the web service VI, you must open an app reference to that EXE. If you try to just use the Default App Instance, you will get a reference to the app instance of the EXE that started the web server. If you have multiple EXEs, this can be a problem. If you have one EXE that acts as windows service to keep the web server running, then this fact will prevent you from calling into other EXEs. 4. If you use the Open Application Reference function and leave the machine name input blank (because your web service and your EXE are on the same local machine) then the app reference you will get will be for the app instance that your web service is running in, NOT your EXE, even if you supply a different VI Server port number that is unique to your EXE. It just will never work. I think this is a bug, IMHO. 5. In order to connect to your EXE, you must provide both the actual IP address of your machine and the VI Server port of you EXE. An easy way to get the IP is to wire the output of the 'String to IP' function into the input of the 'IP to String' function, set the use dot notation input to TRUE and do not wire anything into the 'String to IP' function. Wire the output of 'IP to String' into the machine name input on your Open Application Reference function. I hope this saves someone some time. I wasted a day on this. Too bad NI chose not to document any of this... Quote Link to comment
ned Posted April 19, 2009 Report Share Posted April 19, 2009 QUOTE (jlokanis @ Apr 17 2009, 06:59 PM) 5. In order to connect to your EXE, you must provide both the actual IP address of your machine and the VI Server port of you EXE. An easy way to get the IP is to wire the output of the 'String to IP' function into the input of the 'IP to String' function, set the use dot notation input to TRUE and do not wire anything into the 'String to IP' function. Wire the output of 'IP to String' into the machine name input on your Open Application Reference function. You should be able to wire the string "localhost" or the IP address 127.0.0.1 to get a connection to the local machine, rather than going through String to IP and back. Quote Link to comment
John Lokanis Posted April 21, 2009 Report Share Posted April 21, 2009 QUOTE (ned @ Apr 18 2009, 01:27 PM) You should be able to wire the string "localhost" or the IP address 127.0.0.1 to get a connection to the local machine, rather than going through String to IP and back. I will give that a try, but I doubt the 'localhost' string will work since that is the default value if left unwired and when I did that it definitely did not work. Quote Link to comment
James Brunner Posted November 16, 2010 Report Share Posted November 16, 2010 I have spent some time trying to figure this out and here is what I can tell you that might be helpful. ... I hope this saves someone some time. I wasted a day on this. Too bad NI chose not to document any of this... John, this was HUGELY helpful, but I did find it too late! Thank you so much for documenting this. I am just starting the process for learning these sort of "tidbits" under LV2010 application web server architecture. Hopefully, not much has changed regarding the instance-to-instance behaviors. -- James Quote Link to comment
Fredxxx Posted May 20, 2011 Report Share Posted May 20, 2011 Hey all! Ned point me here to this thread, because i had a similar problem like NeilA. I want to connect a webmethod Vi with a Main Vi on another application instance. I have rebuilt the solution appendage of Nathank and Ned and partly succeeded with Neds: I can connect the two VIs, when i start them not out of project, but out of the windows explorer (Main Labview Application). With Nathanks appendage I get an error, because, even when i have a project open, the Webmethod VI throws me an error, that no project is found and so i canĀ“t get an application ref. So what i wanna do, is to connect the Webmethod and the Main.vi, even when the MainVI is run through a project. What i think is, that i need to find out what port number the open project has, so i can uniquely select it. But maybe my approach is wrong, like NeilA iam a pretty rookie with G. I hope you guys can help me fixing the problem. Thanks a lot Fred Ps.: I attach a Screenshot of my working Version, which i rebuild from Ned. This works for the Main Labview Application instance. Like I said, i want to get it work for the MainVI in a project :-) Quote Link to comment
ned Posted May 20, 2011 Report Share Posted May 20, 2011 You can assign each project (or target within a project) a separate port number. In the project explorer, right-click My Computer and choose properties. On the VI Server page you can set a port number. Quote Link to comment
Fredxxx Posted May 23, 2011 Report Share Posted May 23, 2011 Hey Ned! Thanks a lot, it's working. I set the port number for the project unter My Computer/ Properties. Then i added a "*" (access granted to everybody) to the access lists. And now i can open my MainVi from every application instance i want. I use the OpenApp node with machine name "127.0.0.1" and the port number i set before! You guys are great! Greetz Fred Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.