How to make PI Web API run at startup

Discussion created by jrog091661 on Oct 6, 2017
Latest reply on Oct 7, 2017 by vkaufmann

I couldn't find a solution for this on the community so I had to figure it out myself, I just thought I should document it here.  In my use case, the PI Web API is meant to be running on a web server and access an assetserver on a different PC.  Now this being a web server, it must be semi frequently updated and restarted for security reasons.   The Normal behavior.png image shows what happens when the API is running properly.  It loads all the points and displays them to the user.  After a restart of the web server however, the web API stops working.  Any pages or data that try to be loaded from it will cause an error.  Post restart.png shows what happens and the error code.  My first ideas on what was wrong had me running all over the place searching for what was wrong in our PI system, but the solution and explanation is actually extremely simple.


So to start off with actually fixing the issue, in the active ports image, you will notice the PI web API port of 443 is not active. So my initial way of fixing this was to rerun the PI Web API admin utility and completely rerun the configuration process.  When loading it up, I noticed the Asset Server was not even connected as shown in the Installation Configurations.png.  Rerunning through the application and leaving every option as is will get the Web API to start working again.  Now obviously this is not at all an optimal solution.  Running the configuration at startup is straight up not feasible for a person to go in and do that every time.  We looked into writing an autoit script to run through these dialog boxes at startup, but that is a bit of a hassle.


There is actually a very simple way to get the PI Web API to run at startup.  Simply press windows+r and then go to the startup folder.  From there, just make the shortcuts shown in the start.png image, go into their compatibility in properties and check run as admin on all of them.  Lastly, just drop them into the startup folder.  Admittedly this is a rather simply solution, but sometimes the last solutions one thinks to check are the simplest.


I hope this saves someone out there the time of trying to figure out why their PI Web API service isn't working.