Example Code

Programmatically Change Port Web Services Are Published

Code and Documents

Attachment

Overview
This example VI shows a way to change the port Web Services when web services are deployed.

 


Description
To change the port web services are published on the following steps have to be followed in LabVIEW:

1)Select Tools » Options

2)Select Web Server under Category

3)Click Configure Web Application Server (This launches the default web browser and goes to the Web Server Configuration)

4)Enter the new port number in the Port field under Application Web Server

5)Press Apply

The problem is when web services are deployed through an installer to another computer the above steps do not work.  The URL for the Web Server Configuration will have to be manually entered.  This configuration utility also requires Microsoft Silverlight.  There are also other situations in which it might be necessary to programmatically change the port the web services are published on.  The attached VI will change the port number the web services are published on by editing the WebAppServer configuration file. 

 


Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  1. Download the attached folder to your computer
  2. Open the VI "Change WebServices Port 2012 NIVerified.vi"
  3. Enter the desired port number in the "New Port Control"
  4. Run the program

 

Additional Information or References
VI Snippet

 VI Snippet.png

 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

 

 

Applications Engineer
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.